affect_cjo.RdThis function updates a Demetra+ workspace (.xml) by assigning
user-defined trading day regressors (CJO) to each seasonal adjustment model
(SAI), based on an external classification (typically created with
retrieve_cjo()).
The function modifies the domainSpec of each series by setting
tradingdays to "UserDefined" with the appropriate regressors
(REG1 … REG6, optionally with LY for leap year).
affect_cjo(cjo, ws_path)[data.frame] A data.frame with at least two columns:
series: names of the series in the workspace.
regs: the standard INSEE CJO set (REG1, REG2, …, REG6, with or without _LY).
Typically this table is produced by retrieve_cjo().
[character] Path to a Demetra+ workspace file
(usually with extension .xml).
Invisibly returns NULL. The workspace file at ws_path is updated
on disk with the new CJO regressors.
For each series in the workspace:
the function looks up its assigned regs in the cjo table,
translates the label (REG1, REG2, …) into the corresponding
user-defined regressors (e.g. r.REG1_Semaine, r.REG5_Lundi, …),
updates the domainSpec with set_tradingdays(option = "UserDefined", ...),
saves the modified workspace.
The file is overwritten in place (replace = TRUE).
if (FALSE) { # \dontrun{
# Load a workspace and apply INSEE CJO sets
cjo_table <- retrieve_cjo("workspace.xml")
affect_cjo(cjo = cjo_table, ws_path = "workspace.xml")
} # }