Learn R Programming

sentopics (version 0.7.4)

sentopics_date: 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

Value

a data.frame with the stored date per document.

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.

Author

Olivier Delmarcelle

See Also

Other sentopics helpers: sentopics_labels(), sentopics_sentiment()

Examples

Run this code
# 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")

Run the code above in your browser using DataLab