fst_ngrams_compare_plot: Plot comparison n-grams

View source: R/04_comparison_functions.R

fst_ngrams_compare_plotR Documentation

Plot comparison n-grams

Description

Plots frequency n-grams with unique n-grams highlighted.

Usage

fst_ngrams_compare_plot(
  table,
  number = 10,
  ngrams = 1,
  unique_colour = "indianred",
  name = NULL,
  override_title = NULL,
  title_size = 20
)

Arguments

table

The table of n-grams, output of 'get_unique_ngrams()'.

number

The number of n-grams, default is '10'.

ngrams

The type of n-grams, default is '1'.

unique_colour

Colour to display unique words, default is '"indianred"'.

name

An optional "name" for the plot, default is 'NULL'.

override_title

An optional title to override the automatic one for the plot. Default is 'NULL'. If 'NULL', title of plot will be 'number' "Most Common 'Term'". 'Term' is "Words", "Bigrams", or "N-Grams" where N > 2.

title_size

size to display plot title

Value

Plot of top n-grams with unique terms highlighted.

Examples

top_child <- fst_freq_table(fst_child)
top_dev <- fst_freq_table(fst_dev_coop)
unique_words <- fst_get_unique_ngrams_separate(top_child, top_dev)
top_child_u <- fst_join_unique(top_child, unique_words)
top_dev_u <- fst_join_unique(top_dev, unique_words)
fst_ngrams_compare_plot(top_child_u, ngrams = 1, name = "Child")
fst_ngrams_compare_plot(top_dev_u, ngrams = 1, name = "Dev", title_size = 10)

finnsurveytext documentation built on April 4, 2025, 5:07 a.m.