Learn R Programming

sentimentr (version 0.0.1)

uncombine: Ungroup a sentiment_by Object to the Sentence Level

Description

Ungroup a sentiment_by object, stretching to the element_id and sentence_id levels.

Usage

uncombine(x, ...)

Arguments

x
A sentiment_by object.
...
Ignored.

Value

Returns a data.table with grouping variables plus:
  • element_id - The id number of the original vector passed to sentiment
  • word_count - Word count summed by grouping variable
  • sd - Standard deviation (sd) of the sentiment/polarity score by grouping variable
  • ave_sentiment - Sentiment/polarity score mean average by grouping variable

Examples

Run this code
mytext <- c(
   'do you like it?  But I hate really bad dogs',
   'I am the best friend.',
   'Do you really like it?  I\'m not happy'
)

(x <- sentiment_by(mytext))
uncombine(x)

(y <- with(presidential_debates_2012, sentiment_by(dialogue, list(person, time))))
uncombine(y)

Run the code above in your browser using DataLab