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)

Arguments

x

a return object from textstat_keyness

show_reference

logical; if TRUE, show key reference features in addition to key target features

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

Value

a ggplot2 object

See also

textstat_keyness

Examples

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) })