# For a 'freqlist' object --------------------
(flist <- freqlist("The man and the mouse.", as_text = TRUE))
keep_re(flist, "[ao]")
drop_re(flist, "[ao]")
keep_re(flist, "[ao]", invert = TRUE) # same as drop_re()
# For a 'types' object -----------------------
(tps <- as_types(letters[1:10]))
keep_re(tps, "[acegi]")
drop_re(tps, "[acegi]")
# For a 'tokens' object ----------------------
(tks <- as_tokens(letters[1:10]))
keep_re(tks, "[acegi]")
drop_re(tks, "[acegi]")
Run the code above in your browser using DataLab