sentiment_total: Sentiment Word Counts

Description Usage Arguments Value Examples

View source: R/rtweetclean.R

Description

Takes an input of of single english words and outputs the number of words associated with eight emotions and positive/negative sentiment. This is based on the the crowd-sourced NRC Emotion Lexicon, which associates words with eight basic emotions (anger, fear, anticipation, trust, surprise, sadness, joy, and disgust) and two sentiments (negative and positive). For more information on NRC: http://saifmohammad.com/WebPages/NRC-Emotion-Lexicon.htm Note that words can be 0:n with emotions (either associated with none, 1, or many).

Usage

1
sentiment_total(tweets, drop_sentiment = FALSE)

Arguments

tweets

1-column dataframe

drop_sentiment

A true/false bool that drops sentiment rows if no words are associated with that sentiment

Value

dataframe

Examples

1
2
3
4
5
6
tweets <- data.frame(text_only = c("this is example tweet 1",
                             "this is example tweet 2 with a few extra words",
                             "is third",
                             "4th tweet",
                             "fifth tweet"))
sentiment_total(tweets, drop_sentiment = FALSE)

UBC-MDS/rtweetclean documentation built on April 28, 2021, 7:26 p.m.