Skip to content

Instantly share code, notes, and snippets.

@jduckles
Created April 11, 2018 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jduckles/6907f92ad498d53084ceac3f7aa658d5 to your computer and use it in GitHub Desktop.
Save jduckles/6907f92ad498d53084ceac3f7aa658d5 to your computer and use it in GitHub Desktop.
library(tidytext)
library(tidyverse)
# Sentiment
# Load corpus
survey <- read_csv("~/Downloads/Data_All_170707/CSV/SWC - Post-workshop Survey.csv")
words <- tibble(instructor=survey$`Do you have specific comments about the instructors or helpers?`) %>%
na.omit() %>%
unnest_tokens(word,instructor) %>%
anti_join(stop_words)
frequent_words <- words %>%
count(word, sort=TRUE)
nrc <- get_sentiments('nrc')
instructor_sentiment <-
frequent_words %>%
inner_join(nrc) %>%
count(sentiment,n, sort=TRUE)
ggplot(instructor_sentiment, aes(x=reorder(sentiment,-Freq) ,y=Freq)) +
geom_bar(stat="identity") +
labs(title="Sentiment analysis of 'Do you have specific comments about \n the instructors or helpers?'", x="Sentiment") +
theme(text = element_text(size=20), axis.text.x = element_text(angle=45, hjust=1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment