plot_bing_word_counts: Plot bar plots of the most frequent words.

Description Usage Arguments Value Examples

View source: R/plot_bing_word_counts.R

Description

Plot bar plots of the most frequent words.

Usage

1
plot_bing_word_counts(bing_word_counts)

Arguments

bing_word_counts

A data frame from calc_bing_word_counts.

Value

A ggplot (ggplot::geom_col).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(experienceAnalysis)
books <- janeaustenr::austen_books() # Jane Austen books
emma <- paste(books[books$book == "Emma", ], collapse = " ") # String with whole book
pp <- paste(books[books$book == "Pride & Prejudice", ], collapse = " ") # String with whole book

# Make data frame with books Emma and Pride & Prejudice
x <- data.frame(
  text = c(emma, pp),
  book = c("Emma", "Pride & Prejudice")
)

# Word counts for both books
calc_bing_word_counts(x, target_col_name = "book", text_col_name = "text",
                      filter_class = NULL) %>%
    plot_bing_word_counts()

CDU-data-science-team/experienceAnalysis documentation built on Dec. 17, 2021, 12:53 p.m.