# Sentiment analysis | |
tknDct <- tokens_lookup(tkn, dictionary = data_dictionary_LSD2015) | |
saDfm <- dfm(tknDct, | |
remove = stopwords("en"), | |
stem = T) | |
summ <- do.call("rbind", by(convert(saDfm, to="data.frame")[,-1], | |
INDICES = date(tweetReduced$created_at), | |
FUN = colSums)) | |
dev.off() # reset past graphical pars | |
plot(date(rownames(summ)), | |
(summ[,2] - summ[,1]) / rowSums(summ[,1:2]), | |
type = "l", xlab = "Date", ylab = "Sentiment score") | |
abline(h = 0) | |
abline(v = date(epAirTime), lty = 2, col = rgb(1,0,0,.5)) | |
text(date(epAirTime) - 3, .095, labels = paste0("Ep.", c(1:6))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment