Learn R Programming

rEMM (version 1.0-5)

find_clusters: Find the EMM State/Cluster for an Observation

Description

Finds the cluster and thus the EMM states for observations.

Usage

## S3 method for class 'tNN,matrix':
find_clusters(x, newdata, match_cluster=c("exact", "nn"), dist = FALSE)

Arguments

x
an EMM object.
newdata
a matrix/data.frame with observations.
match_cluster
find exact or nearest neighbor cluster/state.
dist
also report the distance to the chosen cluster/state (as a data.frame).

Value

  • Returns the name of the matching clusters/states or a data.frame with columns "state" and "dist" if dist=TRUE.

See Also

EMM and tNN

Examples

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

find_clusters(emm, EMMTraffic)

Run the code above in your browser using DataLab