tm_filter | R Documentation |
Interface to apply filter and index functions to corpora.
## S3 method for class 'PCorpus'
tm_filter(x, FUN, ...)
## S3 method for class 'SimpleCorpus'
tm_filter(x, FUN, ...)
## S3 method for class 'VCorpus'
tm_filter(x, FUN, ...)
## S3 method for class 'PCorpus'
tm_index(x, FUN, ...)
## S3 method for class 'SimpleCorpus'
tm_index(x, FUN, ...)
## S3 method for class 'VCorpus'
tm_index(x, FUN, ...)
x |
A corpus. |
FUN |
a filter function taking a text document or a string (if
|
... |
arguments to |
tm_filter
returns a corpus containing documents where
FUN
matches, whereas tm_index
only returns the
corresponding indices.
data("crude")
# Full-text search
tm_filter(crude, FUN = function(x) any(grep("co[m]?pany", content(x))))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.