sentometrics
sentometrics copied to clipboard
Custom aggregation in `ctr_agg`
Hi, would it be possible to implement a custom aggregation method in the ctr_agg
function?
At the moment my data is quarterly (GDP and PCE).
[1] "2000-02-01" "2000-05-01" "2000-08-01" "2000-11-01"
The mental model could perhaps look something like:
library(sentometrics)
data("usnews", package = "sentometrics")
aggr_date <- lubridate::floor_date(as.Date(usnews$date), "month")
# OR
aggr_date <- seq.Date(as.Date("2000-02-01"), as.Date("2017-05-01"), by = "3 months")
ctrAgg <- ctr_agg(howWithin = "TFIDF",
howTime = c("equal_weight", "linear"),
do.ignoreZeros = TRUE,
by = "custom", # Specify custom list of dates
do.byCustom = aggr_date, # Provide custom list of date breaks
fill = "zero",
lag = 12,
nCore = parallel::detectCores() -1)