add_clusters {R.temis} | R Documentation |
add_clusters
Description
Add a meta-data variable to a corpus indicating the cluster to which each document belongs.
Usage
add_clusters(corpus, clust)
Arguments
corpus |
A |
clust |
A |
Value
A Corpus
object with meta(corpus, "cluster")
indicating the cluster
of each document.
Examples
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)
[Package R.temis version 0.1.3 Index]