Description Usage Arguments Details Value Examples
Print documents which contain one or more terms and return a sub-corpus with these documents.
1 | concordances(corpus, dtm, terms, all = FALSE)
|
corpus |
A |
dtm |
A |
terms |
One of more terms appearing in |
all |
Whether only documents containing all terms should be printed. By default, documents need to contain at least one of the terms. |
Occurrences of the specified terms are highlighted. If stemming
or other transformations have been applied to original words using
combine_terms
, all original words which have been transformed
to the specified terms are highlighted.
Corpus
object (invisibly).
1 2 3 4 5 6 7 8 9 10 11 | file <- system.file("texts", "reut21578-factiva.xml", package="tm.plugin.factiva")
corpus <- import_corpus(file, "factiva", language="en")
dtm <- build_dtm(corpus)
concordances(corpus, dtm, "oil")
concordances(corpus, dtm, c("oil", "opec"))
concordances(corpus, dtm, c("oil", "opec"), all=TRUE)
# Also works when terms have been combined
dict <- dictionary(dtm)
dtm2 <- combine_terms(dtm, dict)
concordances(corpus, dtm2, "product")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.