Learn R Programming

densityClust (version 0.3.3)

clusters: Extract cluster membership from a densityCluster object

Description

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.

Usage

clusters(x, ...)

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

Value

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

Arguments

x

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

...

Currently ignored

as.list

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

halo.rm

Logical. should halo observations be removed. Defaults to TRUE

Details

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.