frequent_terms: frequent_terms

Description Usage Arguments Value Examples

View source: R/terms.R

Description

List terms with the highest number of occurrences in the document-term matrix of a corpus, possibly grouped by the levels of a variable.

Usage

1
frequent_terms(dtm, variable = NULL, n = 25)

Arguments

dtm

A DocumentTermMatrix.

variable

An optional vector of values giving the groups for which most frequent terms should be reported.

n

The maximal number of terms to report (for each group, if applicable).

Value

A list of matrices, one for each level of the variable, with columns:

Examples

1
2
3
4
5
file <- system.file("texts", "reut21578-factiva.xml", package="tm.plugin.factiva")
corpus <- import_corpus(file, "factiva", language="en")
dtm <- build_dtm(corpus)
frequent_terms(dtm)
frequent_terms(dtm, meta(corpus)$Date)

R.temis documentation built on May 13, 2021, 1:08 a.m.