plot_words: Plot a metric according to word (for instance, frequencies)

View source: R/plot_words.R

plot_wordsR Documentation

Plot a metric according to word (for instance, frequencies)

Description

Plot a metric according to word (for instance, frequencies)

Usage

plot_words(df, words, metric, fill = NULL, fill_fixed = "grey50")

Arguments

df

a tibble with words (or any string to be displayed) and metric (frequency for instance)

words

the name of the column with words

metric

the name of the column with the considered metric

Value

a plot

Examples

mydf=dplyr::bind_rows(tibble::tibble(txt=janeaustenr::prideprejudice,
                                     novel="Pride and Prejudice"),
                      tibble::tibble(txt=janeaustenr::sensesensibility,
                                     novel="Sense and Sensibility")) %>%
  tidytext::unnest_tokens(word,txt)
df_freq <- tidy_frequencies(mydf,
                            cat=word,
                            top_freq=20)
plot_words(df_freq,word,freq)

lvaudor/mixr documentation built on April 14, 2024, 2:17 p.m.