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