# Remove disclaimer comments included in all pages so this doesn't flood the comments and skew results
disclaimers<-c(
"As a reminder, this subreddit is for civil discussion.",
"In general, be courteous to others. Attack ideas, not users. Personal insults, shill or troll accusations, hate speech, any advocating or wishing death/physical harm, and other rule violations can result in a permanent ban.",
"If you see comments in violation of our rules, please report them.",
"I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns."
)
reddit_hourly_data_no_disclaimers<-subset(
reddit_hourly_data,!(Comments%in%c(disclaimers))
)
dim(reddit_hourly_data_no_disclaimers)
head(reddit_hourly_data_no_disclaimers$Comments)
# Score the overall sentiment of each comment
# This library scores sentiment by taking into account the whole sentence
# It takes into account surrounding words of a target word such as 'not happy'
# which cancels out positive sentiment
# A negative value means sentiment is more negative than positive
# A positive values means the sentiment is more positive than negative
#install.packages('sentimentr')
library(sentimentr)
# Comment out this line so it does not cause errors when scheduling to run the script