sentopics_date: Internal date

View source: R/timeSeries.R

sentopics_dateR Documentation

Internal date

Description

Extract or replace the internal dates of a sentopicmodel. The internal dates are used to create time series using the functions sentiment_series() or sentiment_topics(). Dates should be provided by using sentopics_date(x) <- value or by storing a '.date' docvars in the tokens object used to create the model.

Usage

sentopics_date(x, include_docvars = FALSE)

sentopics_date(x) <- value

Arguments

x

a sentopicmodel created from the LDA(), JST(), rJST() or sentopicmodel() function

include_docvars

if TRUE the function will return all docvars stored in the internal tokens object of the model

value

a Date-coercible vector of dates to input into the model.

Value

a data.frame with the stored date per document.

Note

The internal date is stored internally in the docvars of the topic model. This means that dates may also be accessed through the docvars() function, although this is discouraged.

Author(s)

Olivier Delmarcelle

See Also

Other sentopics helpers: sentopics_labels(), sentopics_sentiment()

Examples

# example dataset already contains ".date" docvar
docvars(ECB_press_conferences_tokens)
# dates are automatically stored in the sentopicmodel object
lda <- LDA(ECB_press_conferences_tokens)
sentopics_date(lda)

# dates can be removed or modified by the assignment operator
sentopics_date(lda) <- NULL
sentopics_date(lda) <- docvars(ECB_press_conferences_tokens, ".date")

sentopics documentation built on May 31, 2023, 8:26 p.m.