rEMM (version 1.0-11)

remove: Remove States/Clusters or Transitions from an EMM

Description

Remove states/clusters or transitions from an EMM.

Usage

remove_clusters(x, to_remove, copy = TRUE)
remove_transitions(x, from, to,copy = TRUE)
remove_selftransitions(x, copy = TRUE)

Arguments

x

an EMM object.

to_remove

Names of states/clusters to remove.

from, to

Names of states for removing transitions. If to is missing from has to contain a matrix with two columns (from and to state names).

copy

logical; make a copy of x before reclustering? Otherwise the function will change x!

Value

Returns a EMM with removed states/transitions. If copy=FALSE a reference to the object x with the states/transistions removed is returned.

Details

remove_selftransitions removes the transitions from each state to itself.

Examples

Run this code
# NOT RUN {
data("EMMTraffic")
emm <- EMM(measure="eJaccard", threshold=0.2)
emm <- build(emm, EMMTraffic)

## remove state 3
emm_rs3 <- remove_clusters(emm, "3")

## remove transition 5->2
emm_rt52 <- remove_transitions(emm, "5", "2")

## compare EMMs
op <- par(mfrow = c(2, 2), pty = "m")
plot(emm, method = "graph", main = "original EMM")
plot(emm_rs3, method = "graph", main = "state 3 removed")
plot(emm_rt52, method = "graph", main = "transition 5->2 removed")
par(op)
# }

Run the code above in your browser using DataLab