# For a 'freqlist' object --------------------
(flist <- freqlist("The man and the mouse.", as_text = TRUE))
## like keep_re()
flist[re("[ao]")]
flist[re("[ao]"), invert = TRUE]
## like keep_pos()
flist[type_freqs(flist) < 2]
flist[ranks(flist) <= 3]
flist[ranks(flist) <= 3, invert = TRUE]
flist[2:3]
## like keep_bool()
(flist2 <- keep_bool(flist, type_freqs(flist) < 2))
flist2[orig_ranks(flist2) > 2]
## like keep_types()
flist[c("man", "and")]
flist[as_types(c("man", "and"))]
# For a 'types' object -----------------------
(tps <- as_types(letters[1:10]))
tps[c(1, 3, 5, 7, 9)]
tps[c(TRUE, FALSE)]
tps[c("a", "c", "e", "g", "i")]
tps[c(1, 3, 5, 7, 9), invert = TRUE]
tps[c(TRUE, FALSE), invert = TRUE]
tps[c("a", "c", "e", "g", "i"), invert = TRUE]
# For a 'tokens' object ----------------------
(tks <- as_tokens(letters[1:10]))
tks[re("[acegi]"), invert = TRUE]
tks[c(1, 3, 5, 7, 9), invert = TRUE]
tks[c(TRUE, FALSE), invert = TRUE]
tks[c("a", "c", "e", "g", "i"), invert = TRUE]
Run the code above in your browser using DataLab