Interface to apply filter and index functions to corpora.
Usage
## S3 method for class 'Corpus':
tm_filter(x, \dots, FUN, doclevel = TRUE, useMeta = FALSE)
## S3 method for class 'Corpus':
tm_index(x, \dots, FUN, doclevel = TRUE, useMeta = FALSE)
Arguments
x
A corpus.
...
Arguments to FUN.
FUN
A filter function returning a logical value.
doclevel
Logical. If the document level flag is set FUN
is applied to each element of x, otherwise FUN is
applied to x itself. If FUN has an attribute
doclevel its value will
useMeta
Logical. Should DMetaData be passed over
to FUN as argument?
Value
tm_filter returns a corpus containing documents where
FUN matches, whereas tm_index only returns the
corresponding indices.
See Also
sFilter for a filter using a simple statement query
language.