Get specific sentiment lexicons in a tidy format, with one row per word, in a form that can be joined with a one-word-per-row dataset. The "bing" option comes from the included sentiments data frame, and others call the relevant function in the textdata package.

get_sentiments(lexicon = c("afinn", "bing", "loughran", "nrc"))

Arguments

lexicon

The sentiment lexicon to retrieve; either "afinn", "bing", "nrc", or "loughran"

Value

A tbl_df with a word column, and either a sentiment column (if lexicon is not "afinn") or a numeric score column (if lexicon is "afinn").

Examples

library(dplyr)
# NOT RUN { get_sentiments("afinn") get_sentiments("nrc") # }
get_sentiments("bing")
#> # A tibble: 6,786 x 2 #> word sentiment #> <chr> <chr> #> 1 2-faces negative #> 2 abnormal negative #> 3 abolish negative #> 4 abominable negative #> 5 abominably negative #> 6 abominate negative #> 7 abomination negative #> 8 abort negative #> 9 aborted negative #> 10 aborts negative #> # … with 6,776 more rows