freq_filter: Support function for subset method

View source: R/subset_tcorpus.r

freq_filterR Documentation

Support function for subset method

Description

Support function to enable subsetting by frequency stats of a given feature. Should only be used within the tCorpus subset method, or any tCorpus method that supports a subset argument.

Usage

freq_filter(x, min = -Inf, max = Inf, top = NULL, bottom = NULL)

Arguments

x

the name of the feature column. Can be given as a call or a string.

min

A number, setting the minimum frequency value

max

A number, setting the maximum frequency value

top

A number. If given, only the top x features with the highest frequency are TRUE

bottom

A number. If given, only the bottom x features with the highest frequency are TRUE

Examples

tc = create_tcorpus(c('a a a b b'))

tc$tokens
tc$subset(subset = freq_filter(token, min=3))
tc$tokens

corpustools documentation built on May 31, 2023, 8:45 p.m.