Description Usage Arguments Value Examples
View source: R/plot_bigrams_network.R
Plot a network of bigrams
1 | plot_bigrams_network(bigrams_table)
|
tfidf_ngrams |
A data frame from |
A ggraph
(ggraph::ggraph
) network of bigrams.
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")
)
# Bigrams for Emma
calc_bigrams_network(x, target_col_name = "book", text_col_name = "text",
filter_class = "Emma", bigrams_prop = 3) %>%
plot_bigrams_network()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.