clusters {densityClust}R Documentation

Extract cluster membership from a densityCluster object


This function allows the user to extract the cluster membership of all the observations in the given densityCluster object. The output can be formatted in two ways as described below. Halo observations can be chosen to be removed from the output.


clusters(x, ...)

## S3 method for class 'densityCluster'
clusters(x, as.list = FALSE, halo.rm = TRUE, ...)



The densityCluster object. findClusters() must have been performed prior to this call to avoid throwing an error.


Currently ignored


Should the output be in the list format. Defaults to FALSE


Logical. should halo observations be removed. Defaults to TRUE


Two formats for the output are available. Either a vector of integers denoting for each observation, which cluster the observation belongs to. If halo observations are removed, these are set to NA. The second format is a list with a vector for each group containing the index for the member observations in the group. If halo observations are removed their indexes are omitted. The list format correspond to the following transform of the vector format split(1:length(clusters), clusters), where clusters are the cluster information in vector format.


A vector or list with cluster memberships for the observations in the initial distance matrix

[Package densityClust version 0.3.2 Index]