Open serappfd opened 6 years ago
Find the 10 most used words and show them on the chart
library(gutenbergr) library(tidytext) library(dplyr) library(tidyverse) library(widyr) library(ggplot2) tom_sawyer <- gutenberg_download(c(74)) tom_sawyer tom_sawyer %>% mutate(linenumber = row_number()) %>% ungroup() %>% unnest_tokens(word, text) %>% mutate(section = row_number() %/% 30) %>% count(word, sort=TRUE) %>% filter(!word %in% stop_words$word) %>% top_n(10) %>% ungroup() %>% mutate(word = reorder(word,n)) %>% ggplot(aes(word, n, fill = word)) + geom_col(show.legend = FALSE) + labs(x = NULL, y = "n") + coord_flip()
Is this question
tidytext, dplyr, ggplot, tidyverse, widyr
Question
Find the 10 most used words and show them on the chart
Additional information
Originality
Is this question
Difficulty Level
Tags
tidytext, dplyr, ggplot, tidyverse, widyr