scclust: Constructor for scclust objects

Description Usage Arguments Details Value Examples

View source: R/scclust.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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])

scclust documentation built on May 2, 2019, 4:04 p.m.