plot_words | R Documentation |
Plot a metric according to word (for instance, frequencies)
plot_words(df, words, metric, fill = NULL, fill_fixed = "grey50")
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 |
a plot
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.