Difference between revisions of "R: tidytext: bronte"

From OnnoWiki
Jump to navigation Jump to search
(Created page with "# Ref: https://github.com/dgrtwo/tidy-text-mining/blob/master/01-tidy-text.Rmd library(knitr) opts_chunk$set(message = FALSE, warning = FALSE, cache = TRUE) options(width = 1...")
 
 
Line 1: Line 1:
# Ref: https://github.com/dgrtwo/tidy-text-mining/blob/master/01-tidy-text.Rmd
+
# Ref: https://github.com/dgrtwo/tidy-text-mining/blob/master/01-tidy-text.Rmd
  
library(knitr)
+
library(knitr)
opts_chunk$set(message = FALSE, warning = FALSE, cache = TRUE)
+
opts_chunk$set(message = FALSE, warning = FALSE, cache = TRUE)
options(width = 100, dplyr.width = 100)
+
options(width = 100, dplyr.width = 100)
library(ggplot2)
+
library(ggplot2)
theme_set(theme_light())
+
theme_set(theme_light())
library(dplyr)
+
library(dplyr)
library(stringr)
+
library(stringr)
  
bronte <- gutenberg_download(c(1260, 768, 969, 9182, 767))
+
bronte <- gutenberg_download(c(1260, 768, 969, 9182, 767))
  
tidy_bronte <- bronte %>%
+
tidy_bronte <- bronte %>%
  unnest_tokens(word, text) %>%
+
  unnest_tokens(word, text) %>%
  anti_join(stop_words)
+
  anti_join(stop_words)
  
tidy_bronte %>%
+
tidy_bronte %>%
  count(word, sort = TRUE)
+
  count(word, sort = TRUE)
  
  

Latest revision as of 11:03, 2 December 2019

# Ref: https://github.com/dgrtwo/tidy-text-mining/blob/master/01-tidy-text.Rmd
library(knitr)
opts_chunk$set(message = FALSE, warning = FALSE, cache = TRUE)
options(width = 100, dplyr.width = 100)
library(ggplot2)
theme_set(theme_light())
library(dplyr)
library(stringr)
bronte <- gutenberg_download(c(1260, 768, 969, 9182, 767))
tidy_bronte <- bronte %>%
  unnest_tokens(word, text) %>%
  anti_join(stop_words)
tidy_bronte %>%
  count(word, sort = TRUE)


Referensi


Pranala Menarik