Skip to content

Commit

Permalink
Merge pull request #53 from TanguyBarthelemy/develop
Browse files Browse the repository at this point in the history
update repo
  • Loading branch information
TanguyBarthelemy authored Jul 12, 2024
2 parents b7b918d + 9dc2306 commit 5791903
Show file tree
Hide file tree
Showing 26 changed files with 784 additions and 1,024 deletions.
24 changes: 20 additions & 4 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
^.*\.Rproj$
^\.Rproj\.user$

^\.git$
^\.github$
^\.lintr$
^LICENSE$

^README\.Rmd$
^README\.html$
^_pkgdown\.yml$
^README-.*\.png$

^Meta$
^docs$
^doc$
^pkgdown$
^_pkgdown\.yml$

^\.lintr$

^appveyor\.yml$
.travis.yml

cran-comments.md

^\.DS_Store$

^revdep$
^reconf\.sh$
^pom\.xml$
5 changes: 1 addition & 4 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch

name: test-coverage

Expand Down
57 changes: 54 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,58 @@
.Rproj.user
# History files
.Rhistory
.Rapp.history

# Session Data files
.RData
.RDataTmp

# User-specific files
.Ruserdata
docs

TO_DO
# Example code in package build process
*-Ex.R

# Output files from R CMD build
/*.tar.gz

# Output files from R CMD check
/*.Rcheck/

# RStudio files
.Rproj.user/

# produced vignettes
vignettes/*.html
vignettes/*.pdf
Meta/
inst/doc/
doc/

# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
.httr-oauth

# knitr and R markdown default cache directories
*_cache/
/cache/

# Temporary files created by R markdown
*.utf8.md
*.knit.md

# R Environment Variables
.Renviron

# pkgdown site
docs/

# translation temp files
po/*~

# RStudio Connect folder
rsconnect/

# Hidden file from mac-os
.DS_Store

# produced README.html
README.html
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Authors@R: c(
person("Alain", "Quartier-la-Tente", role = c("aut"),
email = "[email protected]",
comment = c(ORCID = "0000-0001-7890-3857")),
person("Tanguy", "Barthelemy", role = c("aut","cre"),
person("Tanguy", "Barthelemy", role = c("aut", "cre", "art"),
email ="[email protected]"),
person("Anna", "Smyk", role = c("aut"),
email ="[email protected]")
Expand Down
20 changes: 10 additions & 10 deletions R/print.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#'@importFrom stats printCoefmat
#'@importFrom utils capture.output
print_x11_decomp <- function(x, digits = max(3L, getOption("digits") - 3L), ...){
mstats = matrix(unlist(x$mstats),
mstats <- matrix(unlist(x$mstats),
ncol = 1,
dimnames = list(names(x$mstats), "M stats"))
cat("Monitoring and Quality Assessment Statistics:",
Expand All @@ -17,9 +17,9 @@ print_x11_decomp <- function(x, digits = max(3L, getOption("digits") - 3L), ...)
}
print_diagnostics <- function(x, digits = max(3L, getOption("digits") - 3L),
...){
diagnostics = rjd3toolkit::diagnostics(x)
variance_decomposition = diagnostics$variance_decomposition
residual_tests = diagnostics$residual_tests
diagnostics <- rjd3toolkit::diagnostics(x)
variance_decomposition <- diagnostics$variance_decomposition
residual_tests <- diagnostics$residual_tests

cat("Relative contribution of the components to the stationary",
"portion of the variance in the original series,",
Expand Down Expand Up @@ -292,13 +292,13 @@ plot.JD3_X13_OUTPUT <- function(x, first_date = NULL, last_date = NULL,
#' @importFrom rjd3toolkit diagnostics
#' @export
diagnostics.JD3_X13_RSLTS<-function(x, ...){
if (is.null(x)) return (NULL)
variance_decomposition = x$diagnostics$vardecomposition
variance_decomposition = matrix(unlist(variance_decomposition),
if (is.null(x)) return(NULL)
variance_decomposition <- x$diagnostics$vardecomposition
variance_decomposition <- matrix(unlist(variance_decomposition),
ncol = 1,
dimnames = list(names(variance_decomposition), "Component"))
residual_tests = x$diagnostics[grep("test", names(x$diagnostics))]
residual_tests = data.frame(Statistic = sapply(residual_tests, function(test) test[["value"]]),
residual_tests <- x$diagnostics[grep("test", names(x$diagnostics))]
residual_tests <- data.frame(Statistic = sapply(residual_tests, function(test) test[["value"]]),
P.value = sapply(residual_tests, function(test) test[["pvalue"]]),
Description = sapply(residual_tests, function(test) attr(test, "distribution")))
list(preprocessing = rjd3toolkit::diagnostics(x$preprocessing),
Expand All @@ -308,5 +308,5 @@ diagnostics.JD3_X13_RSLTS<-function(x, ...){

#' @export
diagnostics.JD3_X13_OUTPUT<-function(x, ...){
return (rjd3toolkit::diagnostics(x$result, ...))
return(rjd3toolkit::diagnostics(x$result, ...))
}
10 changes: 5 additions & 5 deletions R/revisions.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ NULL
.jrevisions<-function(jts, jspec, jcontext){
jrslt<-.jcall("jdplus/x13/base/r/X13RevisionHistory",
"Ljdplus/toolkit/base/r/timeseries/Revisions;", "revisions", jts, jspec, jcontext)
return (jrslt)
return(jrslt)
}


Expand Down Expand Up @@ -67,26 +67,26 @@ x13_revisions<-function(ts, spec, data_ids=NULL, ts_ids=NULL, cmp_ids=NULL, cont
if (! is.null(data_ids)){
ldata<-lapply(data_ids, function(data_id){
w<-.jcall(jr, "Ljdplus/toolkit/base/api/timeseries/TsData;", "history", data_id$id, data_id$start)
return (rjd3toolkit::.jd2r_tsdata(w))
return(rjd3toolkit::.jd2r_tsdata(w))
})
names(ldata) <- sapply(data_ids, `[[`,"id")
}
lts<-NULL
if (! is.null(ts_ids)){
lts<-lapply(ts_ids, function(ts_id){
w<-.jcall(jr, "Ljdplus/toolkit/base/api/timeseries/TsData;", "tsHistory", ts_id$id, ts_id$period, ts_id$start)
return (rjd3toolkit::.jd2r_tsdata(w))
return(rjd3toolkit::.jd2r_tsdata(w))
})
names(lts) <- sapply(ts_ids, `[[`,"id")
}
lcmp<-NULL
if (! is.null(cmp_ids)){
lcmp<-lapply(cmp_ids, function(cmp_id){
w<-.jcall(jr, "Ljdplus/toolkit/base/api/timeseries/TsDataTable;", "tsSelect", cmp_id$id, cmp_id$start, cmp_id$end)
return (rjd3toolkit::.jd2r_mts(w))
return(rjd3toolkit::.jd2r_mts(w))
})
names(lcmp) <- sapply(cmp_ids, `[[`,"id")
}

return (list(data=ldata, series=lts, components=lcmp))
return(list(data=ldata, series=lts, components=lcmp))
}
2 changes: 1 addition & 1 deletion R/set_x11_spec.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ set_x11.JD3_X11_SPEC <- function(x,
if ((henderson.filter != 0) && (henderson.filter %% 2 == 0)) {
warning("The variable henderson.filter should be an odd number or equal to 0.", call. = FALSE)
} else {
x$henderson = henderson.filter
x$henderson <- henderson.filter
}
}

Expand Down
20 changes: 10 additions & 10 deletions R/udvar.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
.add_ud_var <- function(x, jx, userdefined = NULL, out_class = NULL, result = FALSE){
if (is.null(userdefined)) {
x$user_defined = rjd3toolkit::user_defined(x, NULL)
x$user_defined <- rjd3toolkit::user_defined(x, NULL)
} else {
if (result) {
res = jx
res <- jx
} else {
if (is.null(out_class)) {
res = jx$getResult()
res <- jx$getResult()
} else {
res = .jcall(jx, out_class, "getResult")
res <- .jcall(jx, out_class, "getResult")
}
}
res = rjd3toolkit::.jd3_object(res, result = TRUE)
x$user_defined = rjd3toolkit::user_defined(res, userdefined = userdefined)
res <- rjd3toolkit::.jd3_object(res, result = TRUE)
x$user_defined <- rjd3toolkit::user_defined(res, userdefined = userdefined)
}
x
}
Expand Down Expand Up @@ -48,7 +48,7 @@ userdefined_variables_x13 <- function(x = c("X-13","RegArima","X-11")){
# sort() |>
# dput()

sa_x13 = c("adjust", "arima.bd", "arima.bp", "arima.bphi(*)", "arima.bq",
sa_x13 <- c("adjust", "arima.bd", "arima.bp", "arima.bphi(*)", "arima.bq",
"arima.btheta(*)", "arima.d", "arima.p", "arima.phi(*)", "arima.q",
"arima.theta(*)", "benchmarking.original", "benchmarking.result",
"benchmarking.target", "cal", "cal_b", "cal_b(?)", "cal_f", "cal_f(?)",
Expand Down Expand Up @@ -146,7 +146,7 @@ userdefined_variables_x13 <- function(x = c("X-13","RegArima","X-11")){
# sort() |>
# dput()

sa_regarima = c("adjust", "arima.bd", "arima.bp", "arima.bphi(*)", "arima.bq",
sa_regarima <- c("adjust", "arima.bd", "arima.bp", "arima.bphi(*)", "arima.bq",
"arima.btheta(*)", "arima.d", "arima.p", "arima.phi(*)", "arima.q",
"arima.theta(*)", "cal", "cal_b(?)", "cal_f(?)", "det", "det_b(?)",
"det_f(?)", "det_i", "det_i_b(?)", "det_i_f(?)", "det_s", "det_s_b(?)",
Expand Down Expand Up @@ -187,13 +187,13 @@ userdefined_variables_x13 <- function(x = c("X-13","RegArima","X-11")){
# sort() |>
# dput()

sa_x11 = c("b1", "b10", "b11", "b13", "b17", "b2", "b20", "b3", "b4",
sa_x11 <- c("b1", "b10", "b11", "b13", "b17", "b2", "b20", "b3", "b4",
"b5", "b6", "b7", "b8", "b9", "c1", "c10", "c11", "c13", "c17",
"c2", "c20", "c4", "c5", "c6", "c7", "c9", "d1", "d10", "d11",
"d12", "d13", "d2", "d4", "d5", "d6", "d7", "d8", "d9", "d9-global-msr",
"d9-msr", "d9-msr-table", "seasonal-filters", "trend-filter",
"x11-all")
switch (x,
switch(x,
x13 = sa_x13,
regarima = sa_regarima,
x11 = sa_x11
Expand Down
Loading

0 comments on commit 5791903

Please sign in to comment.