| cluster_data | R Documentation |
Performs clustering using specified dissimilarity measures
and clustering methods. The rows of the data are first converted to strings
and compared using the dissimilarity measures available in the
stringdist package.
cluster_data(
data,
k,
dissimilarity = "hamming",
method = "pam",
na_syms = c("*", "%"),
weighted = FALSE,
lambda = 1,
...
)
cluster_sequences(
data,
k,
dissimilarity = "hamming",
method = "pam",
na_syms = c("*", "%"),
weighted = FALSE,
lambda = 1,
...
)
data |
A |
k |
An |
dissimilarity |
A |
method |
A |
na_syms |
A |
weighted |
A |
lambda |
A |
... |
Additional arguments passed to |
A tna_clustering object which is a list containing:
data: The original data.
k: The number of clusters.
assignments: An integer vector of cluster assignments, one per
sequence (row of data).
silhouette: The average silhouette width of the clustering.
sizes: An integer vector of cluster sizes.
method: The clustering method used.
distance: The dissimilarity matrix (a dist object).
The result can be passed to group_model() to build a TNA model for
each cluster.
Kaufman, L., & Rousseeuw, P. J. (1990). Finding Groups in Data: An Introduction to Cluster Analysis. Wiley. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/9780470316801")}
Rousseeuw, P. J. (1987). Silhouettes: A graphical aid to the interpretation and validation of cluster analysis. Journal of Computational and Applied Mathematics, 20, 53–65. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/0377-0427(87)90125-7")}
Cluster-related functions
communities(),
group_model(),
mmm_stats(),
print.tna_clustering(),
rename_groups()
data <- data.frame(
T1 = c("A", "B", "A", "C", "A", "B"),
T2 = c("B", "A", "B", "A", "C", "A"),
T3 = c("C", "C", "A", "B", "B", "C")
)
# PAM clustering with the Hamming distance (the defaults)
result <- cluster_sequences(data, k = 2)
print(result)
# Hierarchical clustering with the optimal string alignment distance
result <- cluster_sequences(data, k = 2, dissimilarity = "osa",
method = "complete")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.