| cluster_network | R Documentation |
Combines sequence clustering and network estimation into a single call.
Clusters the data using the specified algorithm, then calls
build_network on each cluster subset.
cluster_network(data, k, cluster_by = "pam", dissimilarity = "hamming", ...)
data |
Sequence data. Accepts a data frame, matrix, or
|
k |
Integer. Number of clusters. |
cluster_by |
Character. Clustering algorithm passed to
|
dissimilarity |
Character. Distance metric for sequence clustering
(ignored when |
... |
Passed directly to |
If data is a netobject and method is not provided in
..., the original network method is inherited automatically so the
per-cluster networks match the type of the input network.
A netobject_group.
build_clusters, cluster_mmm,
build_network
seqs <- data.frame(V1 = c("A","B","C","A","B"), V2 = c("B","C","A","B","A"),
V3 = c("C","A","B","C","B"))
grp <- cluster_network(seqs, k = 2)
grp
seqs <- data.frame(
V1 = sample(LETTERS[1:4], 50, TRUE), V2 = sample(LETTERS[1:4], 50, TRUE),
V3 = sample(LETTERS[1:4], 50, TRUE), V4 = sample(LETTERS[1:4], 50, TRUE)
)
# Default: PAM clustering, relative (transition) networks
grp <- cluster_network(seqs, k = 3)
# Specify network method (cor requires numeric panel data)
## Not run:
panel <- as.data.frame(matrix(rnorm(1500), nrow = 300, ncol = 5))
grp <- cluster_network(panel, k = 2, method = "cor")
## End(Not run)
# MMM-based clustering
grp <- cluster_network(seqs, k = 2, cluster_by = "mmm")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.