add_clusters | R Documentation |
Add a meta-data variable to a corpus indicating the cluster to which each document belongs.
add_clusters(corpus, clust)
corpus |
A |
clust |
A |
A Corpus
object with meta(corpus, "cluster")
indicating the cluster
of each document.
file <- system.file("texts", "reut21578-factiva.xml", package="tm.plugin.factiva")
corpus <- import_corpus(file, "factiva", language="en")
dtm <- build_dtm(corpus)
res <- corpus_ca(corpus, dtm, ncp=2, sparsity=0.98)
clust <- corpus_clustering(res, 3)
corpus <- add_clusters(corpus, clust)
meta(corpus)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.