melt.sentopicmodel {sentopics}R Documentation

Melt for sentopicmodels

Description

This function extracts the estimated document mixtures from a topic model and returns them in a long data.table format.

Usage

## S3 method for class 'sentopicmodel'
melt(data, ..., include_docvars = FALSE)

Arguments

data

a model created from the LDA(), JST() or rJST() function and estimated with fit()

...

not used

include_docvars

if TRUE, the melted result will also include the docvars stored in the tokens object provided at model initialization

Value

A data.table in the long format, where each line is the estimated proportion of a single topic/sentiment for a document. For JST and rJST models, the probability is also decomposed into 'L1' and 'L2' layers, representing the probability at each layer of the topic-sentiment hierarchy.

Author(s)

Olivier Delmarcelle

See Also

topWords() for extracting representative words, data.table::melt() and data.table::dcast()

Examples

# only returns topic proportion for LDA models
lda <- LDA(ECB_press_conferences_tokens)
lda <- fit(lda, 10)
melt(lda)

# includes sentiment for JST and rJST models
jst <- JST(ECB_press_conferences_tokens)
jst <- fit(jst, 10)
melt(jst)

[Package sentopics version 0.7.3 Index]