tm_filter
From tm v0.6-2
by Ingo Feinerer
Filter and Index Functions on Corpora
Interface to apply filter and index functions to corpora.
Usage
"tm_filter"(x, FUN, ...)
"tm_filter"(x, FUN, ...)
"tm_index"(x, FUN, ...)
"tm_index"(x, FUN, ...)
Arguments
- x
- A corpus.
- FUN
- a filter function taking a text document as input and returning a logical value.
- ...
- arguments to
FUN
.
Value
tm_filter
returns a corpus containing documents where
FUN
matches, whereas tm_index
only returns the
corresponding indices.
Examples
data("crude")
# Full-text search
tm_filter(crude, FUN = function(x) any(grep("co[m]?pany", content(x))))
Community examples
Looks like there are no examples yet.