Learn R Programming

sentometrics (version 0.2)

perform_agg: Aggregate textual sentiment across documents and time

Description

Condense document-level textual sentiment scores into a panel of textual sentiment measures by aggregating across documents and time. This function is called within sento_measures, applied on the output of compute_sentiment.

Usage

perform_agg(toAgg, ctr)

Arguments

toAgg

output from a compute_sentiment call.

ctr

output from a ctr_agg call. The "howWithin" argument plays no more role.

Value

A sentomeasures object.

See Also

compute_sentiment, ctr_agg, sento_measures

Examples

Run this code
# NOT RUN {
data("usnews")
data("lexicons")
data("valence")

# computation of sentiment and aggregation into sentiment measures
corpus <- sento_corpus(corpusdf = usnews)
corpusSample <- quanteda::corpus_sample(corpus, size = 1000)
l <- setup_lexicons(lexicons[c("LM_eng", "HENRY_eng")], valence[["valence_eng"]])
sent <- compute_sentiment(corpusSample, l, how = "counts")
ctr <- ctr_agg(howTime = c("linear"), by = "year", lag = 3)
sentomeasures <- perform_agg(sent, ctr)

# }

Run the code above in your browser using DataLab