dgrtwo / tidy-text-mining

Manuscript of the book "Tidy Text Mining with R" by Julia Silge and David Robinson
http://tidytextmining.com
Other
1.31k stars 806 forks source link

ch3 sentiment clarity #16

Closed JosiahParry closed 7 years ago

JosiahParry commented 7 years ago

Please clarify why the index is created using the quotient of linenumber / 80 in the middle of the 3rd Chapter

library(tidyr)

janeaustensentiment <- tidy_books %>%
  inner_join(get_sentiments("bing")) %>%
  count(book, index = linenumber %/% 80, sentiment) %>%
  spread(sentiment, n, fill = 0) %>%
  mutate(sentiment = positive - negative)
JosiahParry commented 7 years ago

Awesome! Thank you so much! @juliasilge