R.temis (version 0.1.3)

add_clusters: 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 Corpus object.

clust

A HCPC object resulting from a call to corpus_clustering.

Value

A Corpus object with meta(corpus, "cluster") indicating the cluster of each document.

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab