Description Usage Arguments Details Value Author(s) Examples
View source: R/sentomeasures_measures_xyz.R
Adds missing dates between earliest and latest date of a sento_measures
object or two more extreme
boundary dates, such that the time series are continuous date-wise. Fills in any missing date with either 0 or the
most recent non-missing value.
1 2 3 4 5 6 | measures_fill(
sento_measures,
fill = "zero",
dateBefore = NULL,
dateAfter = NULL
)
|
sento_measures |
a |
fill |
an element of |
dateBefore |
a date as |
dateAfter |
a date as |
The dateBefore
and dateAfter
dates are converted according to the sento_measures[["by"]]
frequency.
A modified sento_measures
object.
Samuel Borms
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # construct a sento_measures object to start with
corpus <- sento_corpus(corpusdf = sentometrics::usnews)
corpusSample <- quanteda::corpus_sample(corpus, size = 500)
l <- sento_lexicons(sentometrics::list_lexicons[c("LM_en", "HENRY_en")],
sentometrics::list_valence_shifters[["en"]])
ctr <- ctr_agg(howTime = c("equal_weight", "linear"), by = "day", lag = 7, fill = "none")
sento_measures <- sento_measures(corpusSample, l, ctr)
# fill measures
f1 <- measures_fill(sento_measures)
f2 <- measures_fill(sento_measures, fill = "latest")
f3 <- measures_fill(sento_measures, fill = "zero",
dateBefore = get_dates(sento_measures)[1] - 10,
dateAfter = tail(get_dates(sento_measures), 1) + 15)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.