as.data.table.sento_measures {sentometrics}R Documentation

Get the sentiment measures

Description

Extracts the sentiment measures data.table in either wide (by default) or long format.

Usage

## S3 method for class 'sento_measures'
as.data.table(x, keep.rownames = FALSE, format = "wide", ...)

Arguments

x

a sento_measures object created using sento_measures.

keep.rownames

see as.data.table.

format

a single character vector, one of c("wide", "long").

...

not used.

Value

The panel of sentiment measures under sento_measures[["measures"]], in wide or long format.

Author(s)

Samuel Borms

Examples

data("usnews", package = "sentometrics")
data("list_lexicons", package = "sentometrics")
data("list_valence_shifters", package = "sentometrics")

sm <- sento_measures(sento_corpus(corpusdf = usnews[1:200, ]),
                     sento_lexicons(list_lexicons["LM_en"]),
                     ctr_agg(lag = 3))

data.table::as.data.table(sm)
data.table::as.data.table(sm, format = "long")


[Package sentometrics version 1.0.0 Index]