Skip to contents

Bars of the number (or share) of types and of occurrences that remain after each step, from vocabulary_diagnostics().

Usage

plot_vocabulary_diagnostics(diagnostics, share = FALSE, base_size = 16, ...)

Arguments

diagnostics

Output of vocabulary_diagnostics().

share

Logical scalar: plot the share of the first step instead of the counts.

base_size

Numeric scalar, base font size.

...

Not used: an argument renamed in the development version of mintR gives an error naming its replacement.

Value

A ggplot (the plotted table is its data), with a facet for types and one for occurrences, and for each value of by if there is one.

Examples

tokens <- extract_ngrams(
  data.frame(id = 1:3, text = c(
    "labour market reform", "labour market policy", "monetary policy rule"
  )),
  ngrams = 2L, document_col = "id"
)
frequent <- tokens[token %in% tokens[, .N, by = token][N >= 2, token]]
plot_vocabulary_diagnostics(vocabulary_diagnostics(list(all = tokens, frequent = frequent)))