get_sentiments: Get a tidy data frame of a single sentiment lexicon

Description Usage Arguments Value Examples

View source: R/sentiments.R

Description

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. Each of these comes from the included sentiments data frame, but this performs the filtering for a specific lexicon, and removes columns that are not used in that lexicon.

Usage

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

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

1
2
3
library(dplyr)
get_sentiments("afinn")
get_sentiments("bing")

tidytext documentation built on May 29, 2018, 9:04 a.m.