Learn R Programming

sentometrics (version 0.5.6)

measures_select: Select sentiment measures

Description

Selects all sentiment measures which include either all of the given selection components combined, or those who's name consist of at least one of the selection components.

Usage

measures_select(sentomeasures, toSelect)

Arguments

sentomeasures

a sentomeasures object created using sento_measures.

toSelect

a character vector of the lexicon, feature and time weighting scheme names, to indicate which measures need to be selected, or as a list of character vectors, possibly with separately specified combinations (consisting of one unique lexicon, one unique feature, and one unique time weighting scheme at maximum).

Value

A modified sentomeasures object, with only the sentiment measures required, including updated information and statistics, but the original sentiment scores data.table untouched.

See Also

measures_delete

Examples

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

# construct a sentomeasures object to start with
corpus <- sento_corpus(corpusdf = usnews)
corpusSample <- quanteda::corpus_sample(corpus, size = 500)
l <- sento_lexicons(list_lexicons[c("LM_en", "HENRY_en")], list_valence_shifters[["en"]])
ctr <- ctr_agg(howTime = c("equal_weight", "linear"), by = "year", lag = 3)
sentomeasures <- sento_measures(corpusSample, l, ctr)

# different selections
sel1 <- measures_select(sentomeasures, c("equal_weight"))
sel2 <- measures_select(sentomeasures, c("equal_weight", "linear"))
sel3 <- measures_select(sentomeasures, c("linear", "LM_en"))
sel4 <- measures_select(sentomeasures, list(c("linear", "wsj"), c("linear", "economy")))

# }

Run the code above in your browser using DataLab