Learn R Programming

sentometrics (version 0.5.6)

sentiment_bind: Bind sentiment objects row-wise

Description

Combines multiple sentiment objects with the same column names into a new sentiment object. Duplicates in terms of document identifiers across input objects are removed.

Usage

sentiment_bind(...)

Arguments

...

sentiment objects to combine in the order given.

Value

A new, larger, sentiment object.

Examples

Run this code
# NOT RUN {
data("usnews", package = "sentometrics")
data("list_lexicons", package = "sentometrics")
data("list_valence_shifters", package = "sentometrics")

l <- sento_lexicons(list_lexicons[c("LM_en", "HENRY_en")])

corp1 <- sento_corpus(corpusdf = usnews[1:200, ])
corp2 <- sento_corpus(corpusdf = usnews[201:450, ])
corp3 <- sento_corpus(corpusdf = usnews[401:700, ])

sent1 <- compute_sentiment(corp1, l, how = "proportionalPol")
sent2 <- compute_sentiment(corp2, l, how = "counts")
sent3 <- compute_sentiment(corp3, l, how = "proportional")

sent <- sentiment_bind(sent1, sent2, sent3)
nrow(sent) # 700

# }

Run the code above in your browser using DataLab