Skip to content

Custom aggregation in ctr_agg #14

@HanjoStudy

Description

@HanjoStudy

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions