Learn R Programming

rEMM (version 0.1-2)

merge_states: Merge States of an EMM

Description

Merge several clusters/states of an EMM into a single cluster/state.

Usage

## S3 method for class 'EMM,character':
merge_states(x, to_merge, clustering = FALSE, new_center = NULL)

Arguments

x
an "EMM" object.
to_merge
vector of names of the states/clusters to merge. The name of the first state in to_merge is used as the name for the new state representing the merged states.
clustering
is to_merge a vector with cluster assignments as created by a clustering algorithm?
new_center
supply new centers for the merged clusters. New centroids are automatically computed. If (pseudo) medoids are used, new medoids should be supplied. If none is supplied, the medoid of the cluster in to_merge which has the most as

Value

  • A new EMM with the states/clusters merged.

Examples

Run this code
data("EMMTraffic")
emm <- EMM(measure="eJaccard", threshold=0.2)
emm <- build(emm, EMMTraffic)
states(emm)

## merge states 1-3
emm_m123 <- merge_states(emm, c("1", "2", "3"))
states(emm_m123)

Run the code above in your browser using DataLab