R/filter.R

Defines functions tm_index.VCorpus tm_index tm_filter.VCorpus tm_filter

Documented in tm_filter tm_filter.VCorpus tm_index tm_index.VCorpus

# Author: Ingo Feinerer
# Filters

tm_filter <-
function(x, FUN, ...)
    UseMethod("tm_filter", x)
tm_filter.PCorpus <-
tm_filter.SimpleCorpus <-
tm_filter.VCorpus <-
function(x, FUN, ...)
    x[tm_index(x, FUN, ...)]

tm_index <-
function(x, FUN, ...)
    UseMethod("tm_index", x)
tm_index.PCorpus <-
tm_index.SimpleCorpus <-
tm_index.VCorpus <-
function(x, FUN, ...)
    unlist(tm_parLapply(content(x), function(y) isTRUE(FUN(y, ...))))

Try the tm package in your browser

Any scripts or data that you put into this service are public.

tm documentation built on April 7, 2021, 3:01 a.m.