scclust: Constructor for scclust objects

View source: R/scclust.R

scclustR Documentation

Constructor for scclust objects

Description

The scclust function constructs a scclust object from existing cluster labels.

Usage

scclust(cluster_labels, unassigned_labels = NULL, ids = NULL)

Arguments

cluster_labels

a vector containing each data point's cluster label.

unassigned_labels

labels that denote unassigned data points. If NULL, NA values in cluster_labels are used to denote unassigned points.

ids

IDs of the data points. Should be a vector of the same length as cluster_labels or NULL. If NULL, the IDs are set to 1:length(cluster_labels).

Details

scclust does not derive clusters from sets of data points; see sc_clustering and hierarchical_clustering for that functionality.

Value

Returns a scclust object with the clustering described by the provided labels.

Examples

# 10 data points in 3 clusters
my_scclust1 <- scclust(c("A", "A", "B", "C", "B",
                         "C", "C", "A", "B", "B"))

# 8 data points in 3 clusters, 2 points unassigned
my_scclust2 <- scclust(c(1, 1, 2, 3, 2,
                         NA, 3, 1, NA, 2))

# Custom labels indicating unassiged points
my_scclust3 <- scclust(c("A", "A", "B", "C", "NONE",
                         "C", "C", "NONE", "B", "B"),
                       unassigned_labels = "NONE")

# Two different labels indicating unassiged points
my_scclust4 <- scclust(c("A", "A", "B", "C", "NONE",
                         "C", "C", "0", "B", "B"),
                       unassigned_labels = c("NONE", "0"))

# Custom data point IDs
my_labels5 <- scclust(c("A", "A", "B", "C", "B",
                        "C", "C", "A", "B", "B"),
                      ids = letters[1:10])


fsavje/scclust-R documentation built on Jan. 5, 2024, 2:34 a.m.