Plot the results of a "keyword" of features comparing their differential
associations with a target and a reference group, after calculating keyness
using textstat_keyness
.
textplot_keyness(x, show_reference = TRUE, n = 20L, min_count = 2L)
x | a return object from |
---|---|
show_reference | logical; if |
n | integer; number of features to plot |
min_count | numeric; minimum total count of feature across the target and reference categories, for a feature to be included in the plot |
a ggplot2 object
not_run({ # compare Trump v. Obama speeches prescorpus <- corpus_subset(data_corpus_inaugural, President %in% c("Obama", "Trump")) presdfm <- dfm(prescorpus, groups = "President", remove = stopwords("english"), remove_punct = TRUE) result <- textstat_keyness(presdfm, target = "Trump") # plot estimated word keyness textplot_keyness(result) textplot_keyness(result, show_reference = FALSE) })