{rjd3workspace} contains various functions to wrangle JDemetra+ v3.x workspaces.
Seasonal adjustment with X13-ARIMA can be done with the package {rjd3x13} and with TRAMO-SEATS with the package {rjd3tramoseats}.
Installation
{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")Latest release
To get the current stable version (from the latest release):
- From GitHub:
# install.packages("remotes")
remotes::install_github("rjdverse/rjd3workspace@*release")- From r-universe:
install.packages("rjd3workspace", repos = c("https://rjdverse.r-universe.dev", "https://cloud.r-project.org"))Development version
You can install the development version of {rjd3workspace} from GitHub with:
# install.packages("remotes")
remotes::install_github("rjdverse/rjd3workspace")Usage
Create a Workspace with two SA-items
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)Create SA-item with path
# 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)Change path of an SA-ITEM
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)Package Maintenance and contributing
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.
Licensing
The code of this project is licensed under the European Union Public Licence (EUPL).