Users can subset output object of textstat_collocations
,
textstat_keyness
or textstat_frequency
based on
"glob"
, "regex"
or "fixed"
patterns using this method.
textstat_select(
x,
pattern = NULL,
selection = c("keep", "remove"),
valuetype = c("glob", "regex", "fixed"),
case_insensitive = TRUE
)
a textstat
object
see quanteda::pattern
whether to "keep"
or "remove"
the rows that
match the pattern
the type of pattern matching: "glob"
for "glob"-style
wildcard expressions; "regex"
for regular expressions; or "fixed"
for
exact matching. See valuetype for details.
logical; if TRUE
, ignore case when matching a
pattern
or dictionary values
library("quanteda")
period <- ifelse(docvars(data_corpus_inaugural, "Year") < 1945, "pre-war", "post-war")
dfmat <- tokens(data_corpus_inaugural) %>%
dfm() %>%
dfm_group(groups = period)
tstat <- textstat_keyness(dfmat)
textstat_select(tstat, 'america*')
Run the code above in your browser using DataLab