Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom aggregation in ctr_agg #14

Open
HanjoStudy opened this issue Aug 19, 2020 · 0 comments
Open

Custom aggregation in ctr_agg #14

HanjoStudy opened this issue Aug 19, 2020 · 0 comments

Comments

@HanjoStudy
Copy link

HanjoStudy commented Aug 19, 2020

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant