
{rjd3workspace} contains various functions to wrangle JDemetra+ v3.x workspaces (create, read, add/remove SA-items..).
Seasonal adjustment in R, without using JDemetra+ workspaces but directly TS (time series class) objects, can be done with {rjd3x13} using X13-ARIMA algorithm or with {rjd3tramoseats} using TRAMO-SEATS algorithm.
{rjd3workspace} relies on the {rJava} package
Running rjd3 packages requires Java 21 or higher. How to set up such a configuration in R is explained here
🎉 {rjd3workspace} is now available on CRAN! 🎉
To install it, just launch the following command line:
install.packages("rjd3workspace")
To get the current stable version (from the latest release):
# install.packages("remotes")
remotes::install_github("rjdverse/rjd3workspace@*release")
install.packages("rjd3workspace", repos = c("https://rjdverse.r-universe.dev", "https://cloud.r-project.org"))
You can install the development version of {rjd3workspace} from GitHub with:
# install.packages("remotes")
remotes::install_github("rjdverse/rjd3workspace")
library("rjd3workspace")
dir <- tempdir()
y <- rjd3toolkit::ABS$X0.2.09.10.M
jws <- jws_new()
jsap1 <- jws_sap_new(jws, "sa1")
add_sa_item(jsap1, name = "x13", x = rjd3x13::x13(y))
add_sa_item(jsap1, name = "tramo", x = rjd3tramoseats::tramoseats(y))
save_workspace(jws, file.path(dir, "ws.xml"))
jws <- jws_open(file = file.path(dir, "ws.xml"))
jws_compute(jws) # to compute the models
jsap1 <- jws_sap(jws, idx = 1) # first SAProcessing
jsa1 <- jsap_sai(jsap1, idx = 1) # first SAItem
sai_name(jsa1)
#> [1] "x13"
mod1 <- read_sai(jsa1)
# install.packages("remotes")
# remotes::install_github("rjdverse/rjd3providers")
dir <- tempdir()
xlsx_file <- file.path(system.file("extdata", package = "rjd3providers"), "Insee.xlsx")
ts1 <- rjd3providers::spreadsheet_series(file = xlsx_file, sheet = 1L, series = 3L)
y <- ts1$data
jws <- jws_new()
jsap1 <- jws_sap_new(jws, "sa1")
add_sa_item(jsap1, name = "x13", x = rjd3x13::x13(y))
set_ts(jsap = jsap1, idx = 1L, y = ts1)
add_sa_item(jsap1, name = "tramo", x = rjd3tramoseats::tramoseats(y))
set_ts(jsap = jsap1, idx = 2L, y = ts1)
save_workspace(jws, file.path(dir, "ws.xml"))
jws <- jws_open(file = file.path(dir, "ws.xml"))
jws_compute(jws) # to compute the models
jsap1 <- jws_sap(jws, idx = 1) # first SAProcessing
jsa1 <- jsap_sai(jsap1, idx = 1) # first SAItem
sai_name(jsa1)
#> [1] "x13"
mod1 <- read_sai(jsa1)
xlsx_path <- normalizePath("data/IPI_nace4.xlsx", mustWork = TRUE)
csv_path <- normalizePath("data/IPI_nace4.csv", mustWork = TRUE)
ws_path <- normalizePath("WS/ws_industrie.xml", mustWork = TRUE)
jws <- .jws_open(file = ws_path)
# Update all the second SA-Processing with a new path
spreadsheet_update_path(
jws = jws,
new_path = xlsx_path,
idx_sap = 2L
)
txt_update_path(
jws = jws,
new_path = csv_path,
idx_sap = 1L
)
save_workspace(jws = jws, file = ws_path, replace = TRUE)
Any contribution is welcome and should be done through pull requests and/or issues. pull requests should include updated tests and updated documentation. If functionality is changed, docstrings should be added or updated.
The code of this project is licensed under the European Union Public Licence (EUPL).
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.