vocabularyTable: Vocabulary summary table

Description Usage Arguments Details See Also


Build a table summarizing vocabulary, optionally over a variable.


vocabularyTable(termsDtm, wordsDtm, variable = NULL, unit = c("document", "global"))



A document-term matrix containing terms (i.e. extracted from a possibly stemmed corpus).


A document-term matrix contaning words (i.e. extracted from a plain corpus).


A vector of the same length as lengthDtm giving indexes according to which categories should be defined. If NULL, per-document measures are returned.


When variable is not NULL, defines the way measures are aggregated (see below).


This dialog allows creating tables providing several vocabulary measures for each document or each category of documents in the corpus:

Words are defined as the forms of two or more characters present in the texts before stemming and stopword removal. On the contrary, unique terms are extracted from the global document-term matrix, which means they do not include words that were removed by treatments ran at the import step, and that words different in the original text might become identical terms if stemming was performed. This can be considered the “correct” measure, since the purpose of corpus processing is exactly that: mark different forms of the same term as similar to allow for statistical analyses.

Please note that percentages for terms and words are computed with regard respectively to the total number of terms and of words, so the denominators are not the same for all measures. See vocabularyDlg.

When variable is not NULL, unit defines two different ways of aggregating per-document statistics into per-category measures:

In both cases, the “Corpus” column follows the above definition.

See Also

vocabularyDlg, codeDocumentTermMatrix, table,

RcmdrPlugin.temis documentation built on May 2, 2019, 11:10 a.m.