From c1a03d89eed7fc4e83706f5147e0081f13509161 Mon Sep 17 00:00:00 2001 From: Tanguy BARTHELEMY Date: Thu, 21 Dec 2023 18:21:57 +0100 Subject: [PATCH] T --> TRUE and F --> FALSE --- R/arima.R | 4 ++-- R/calendars.R | 3 +-- R/display.R | 8 ++++---- R/jd2r.R | 2 -- R/modellingcontext.R | 4 +--- R/procresults.R | 4 +--- R/protobuf.R | 7 ++----- R/regarima_generic.R | 1 - R/regarima_rslts.R | 1 - R/spec_regarima.R | 1 - R/tests_regular.R | 18 ++++++------------ R/tests_seasonality.R | 1 - R/timeseries.R | 6 +++--- R/utils.R | 2 -- R/zzz.R | 2 -- rjd3toolkit.Rproj | 10 ++++++---- 16 files changed, 26 insertions(+), 48 deletions(-) diff --git a/R/arima.R b/R/arima.R index a96c26ed..46d113ad 100644 --- a/R/arima.R +++ b/R/arima.R @@ -150,7 +150,7 @@ arima_model<-function(name="arima", ar=1, delta=1, ma=1, variance=1){ .jarray(as.numeric(model$ar)), .jarray(as.numeric(model$delta)), .jarray(as.numeric(model$ma)), - as.numeric(model$var), F)) + as.numeric(model$var), FALSE)) } #' Sum ARIMA Models @@ -236,7 +236,7 @@ arima_properties<-function(model, nspectrum=601, nacf=36){ #' @export #' #' @examples -ucarima_model<-function(model=NULL, components, complements=NULL, checkmodel=F){ +ucarima_model<-function(model=NULL, components, complements=NULL, checkmodel=FALSE){ if (is.null(model)) model<-arima_lsum(components) else if (! is(model, "JD3_ARIMA") && ! is(model, "JD3_SARIMA")) stop("Invalid model") diff --git a/R/calendars.R b/R/calendars.R index a5880e7a..1adc0e68 100644 --- a/R/calendars.R +++ b/R/calendars.R @@ -676,7 +676,7 @@ weighted_calendar<-function(calendars, weights){ #' More information on calendar correction in JDemetra+ online documentation: #' \url{https://jdemetra-new-documentation.netlify.app/} #' @export -national_calendar<-function(days, mean_correction=T){ +national_calendar<-function(days, mean_correction=TRUE){ if (! is.list(days)) stop ('Days should be a list of holidays') return (structure(list(days=days, mean_correction=mean_correction), class=c('JD3_CALENDAR', 'JD3_CALENDARDEFINITION'))) } @@ -836,4 +836,3 @@ print.JD3_WEIGHTEDCALENDAR <- function (x, ...) return(invisible(x)) } - diff --git a/R/display.R b/R/display.R index 655ab822..ac71e04b 100644 --- a/R/display.R +++ b/R/display.R @@ -131,7 +131,7 @@ print.summary.JD3_SARIMA_ESTIMATION<-function(x, digits = max(3L, getOption("dig stde<-sqrt(diag(cov)) sel<-fr$type=='ESTIMATED' t<-fr$value[sel]/stde - pval<-2*pt(abs(t), ndf, lower.tail = F) + pval<-2*pt(abs(t), ndf, lower.tail = FALSE) fr$stde[sel]<-stde fr$t[sel]<-t fr$pvalue[sel]<-pval @@ -163,7 +163,7 @@ print.summary.JD3_SARIMA_ESTIMATION<-function(x, digits = max(3L, getOption("dig if (length(estimate) > 0){ stde <- sqrt(diag(x$parameters$cov)) t<-estimate/stde - pval<-2*pt(abs(t), ndf, lower.tail = F) + pval<-2*pt(abs(t), ndf, lower.tail = FALSE) table <- data.frame(estimate, "ESTIMATED", stde, t, pval) colnames(table) <- c("Estimate", "Type", "Std. Error", "T-stat", "Pr(>|t|)") @@ -313,7 +313,7 @@ print.JD3_SARIMA_ESTIMATE<-function(x, digits = max(3L, getOption("digits") - 3L sel<-xregs$type=='ESTIMATED' t<-xregs$value[sel]/stde ndf<-q$estimation$likelihood$neffectiveobs-q$estimation$likelihood$nparams+1 - pval<-2*pt(abs(t), ndf, lower.tail = F) + pval<-2*pt(abs(t), ndf, lower.tail = FALSE) xregs$stde[sel]<-stde xregs$t[sel]<-t xregs$pvalue[sel]<-pval @@ -331,7 +331,7 @@ print.JD3_SARIMA_ESTIMATE<-function(x, digits = max(3L, getOption("digits") - 3L if (length(estimate) > 0){ stde <- sqrt(diag(x$bvar)) t<-estimate/stde - pval<-2*pt(abs(t), ndf, lower.tail = F) + pval<-2*pt(abs(t), ndf, lower.tail = FALSE) table <- data.frame(estimate, "ESTIMATED", stde, t, pval) colnames(table) <- c("Estimate", "Type", "Std. Error", "T-stat", "Pr(>|t|)") diff --git a/R/jd2r.R b/R/jd2r.R index 27bb204a..debd2cf0 100644 --- a/R/jd2r.R +++ b/R/jd2r.R @@ -151,5 +151,3 @@ NULL , as.integer(period), as.integer(start[1]), as.integer(start[2]), as.integer(n)) return (jdom) } - - diff --git a/R/modellingcontext.R b/R/modellingcontext.R index 0a83ffc5..24163e19 100644 --- a/R/modellingcontext.R +++ b/R/modellingcontext.R @@ -270,7 +270,7 @@ modelling_context<-function(calendars=NULL, variables=NULL){ if (any(mts_var)) { # case of a simple mts dictionary for (i in which(mts_var)) { - all_var <- lapply(1:ncol(variables[[i]]), function(j) { + all_var <- lapply(seq_len(ncol(variables[[i]])), function(j) { variables[[i]][, j] }) names(all_var) <- colnames(variables[[i]]) @@ -383,5 +383,3 @@ modelling_context<-function(calendars=NULL, variables=NULL){ p<-.r2p_context(r) return (.p2jd_context(p)) } - - diff --git a/R/procresults.R b/R/procresults.R index 1cb4a7c7..4098905b 100644 --- a/R/procresults.R +++ b/R/procresults.R @@ -6,7 +6,7 @@ RSLT<-'JD3_ProcResults' #' @export #' @rdname jd3_utilities -.jd3_object<-function(jobjRef, subclasses=NULL, result=F){ +.jd3_object<-function(jobjRef, subclasses=NULL, result=FALSE){ if (result) classes<-c(OBJ, RSLT, subclasses) else @@ -64,5 +64,3 @@ user_defined <- function(object, userdefined = NULL){ class(result) <- c("user_defined") result } - - diff --git a/R/protobuf.R b/R/protobuf.R index 8a155c4a..95243824 100644 --- a/R/protobuf.R +++ b/R/protobuf.R @@ -239,7 +239,7 @@ NULL #' @rdname jd3_utilities .p2r_ucarima<-function(p){ model<-.p2r_arima(p$model) - return (ucarima_model(model,lapply(p$components, function(z){.p2r_arima(z)}), lapply(p$complements, function(z){.p2r_arima(z)}), F)) + return (ucarima_model(model,lapply(p$components, function(z){.p2r_arima(z)}), lapply(p$complements, function(z){.p2r_arima(z)}), FALSE)) } @@ -459,7 +459,7 @@ NULL #' @export #' @rdname jd3_utilities -.p2r_sa_decomposition<-function(p, full=F){ +.p2r_sa_decomposition<-function(p, full=FALSE){ if (full){ return (list(mode = .enum_extract(sa.DecompositionMode, p$mode), series=.p2r_sa_component(p$series), @@ -526,6 +526,3 @@ NULL p$forecast<-r$forecast return (p) } - - - diff --git a/R/regarima_generic.R b/R/regarima_generic.R index 9407c687..98b9270b 100644 --- a/R/regarima_generic.R +++ b/R/regarima_generic.R @@ -76,4 +76,3 @@ residuals.JD3_REGARIMA_RSLTS <- function(object, ...){ object <- object$estimation object$res } - diff --git a/R/regarima_rslts.R b/R/regarima_rslts.R index f68213ae..89e8e30a 100644 --- a/R/regarima_rslts.R +++ b/R/regarima_rslts.R @@ -39,4 +39,3 @@ NULL tnames<-lapply(p$residuals_tests, function(z){z$key}) testonresiduals<-`names<-`(tlist, tnames) } - diff --git a/R/spec_regarima.R b/R/spec_regarima.R index 812a22ad..e8ec483a 100644 --- a/R/spec_regarima.R +++ b/R/spec_regarima.R @@ -1549,4 +1549,3 @@ set_span <- function(x, } x } - diff --git a/R/tests_regular.R b/R/tests_regular.R index 563ecc46..7040d37a 100644 --- a/R/tests_regular.R +++ b/R/tests_regular.R @@ -67,7 +67,7 @@ print.JD3_TEST<-function(x, details=FALSE, ...){ #' ljungbox(random_t(2, 100), lag = 24, k =1) #' ljungbox(ABS$X0.2.09.10.M, lag = 24, k =1) #' @export -ljungbox<-function(data, k=1, lag=1, nhp=0, sign=0, mean=T){ +ljungbox<-function(data, k=1, lag=1, nhp=0, sign=0, mean=TRUE){ jtest<-.jcall("jdplus/toolkit/base/r/stats/Tests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "ljungBox", as.numeric(data), as.integer(k), as.integer(lag), as.integer(nhp), as.integer(sign), as.logical(mean)) return (.jd2r_test(jtest)) @@ -112,7 +112,7 @@ doornikhansen<-function(data){ #' @export #' @describeIn normality_tests Jarque-Bera test -jarquebera<-function(data, k=0, sample=T){ +jarquebera<-function(data, k=0, sample=TRUE){ jtest<-.jcall("jdplus/toolkit/base/r/stats/Tests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "jarqueBera", as.numeric(data), as.integer(k), as.logical(sample)) return (.jd2r_test(jtest)) @@ -141,7 +141,7 @@ NULL #' @describeIn runstests Runs test around mean or median #' @export -testofruns<-function(data, mean=T, number=T){ +testofruns<-function(data, mean=TRUE, number=TRUE){ jtest<-.jcall("jdplus/toolkit/base/r/stats/Tests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "testOfRuns", as.numeric(data), as.logical(mean), as.logical(number)) return (.jd2r_test(jtest)) @@ -149,7 +149,7 @@ testofruns<-function(data, mean=T, number=T){ #' @describeIn runstests up and down runs test #' @export -testofupdownruns<-function(data, number=T){ +testofupdownruns<-function(data, number=TRUE){ jtest<-.jcall("jdplus/toolkit/base/r/stats/Tests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "testOfUpDownRuns", as.numeric(data), as.logical(number)) return (.jd2r_test(jtest)) @@ -167,7 +167,7 @@ testofupdownruns<-function(data, number=T){ #' autocorrelations_partial(x) #' autocorrelations_inverse(x) #' @export -autocorrelations<-function(data, mean=T, n=15){ +autocorrelations<-function(data, mean=TRUE, n=15){ res = .jcall("jdplus/toolkit/base/r/stats/Tests", "[D", "autocorrelations", as.numeric(data), as.logical(mean), as.integer(n)) names(res) <- seq_len(n) @@ -175,7 +175,7 @@ autocorrelations<-function(data, mean=T, n=15){ } #' @export #' @rdname autocorrelations -autocorrelations_partial<-function(data, mean=T, n=15){ +autocorrelations_partial<-function(data, mean=TRUE, n=15){ res <- .jcall("jdplus/toolkit/base/r/stats/Tests", "[D", "partialAutocorrelations", as.numeric(data), as.logical(mean), as.integer(n)) names(res) <- seq_len(n) @@ -217,9 +217,3 @@ kurtosis<-function(data){ mad<-function(data, centile=50, medianCorrected=TRUE){ return (.jcall("jdplus/toolkit/base/r/stats/Tests", "D", "mad",as.numeric(data), as.numeric(centile), as.logical(medianCorrected))) } - - - - - - diff --git a/R/tests_seasonality.R b/R/tests_seasonality.R index 106e8a3c..40bdbbcf 100644 --- a/R/tests_seasonality.R +++ b/R/tests_seasonality.R @@ -149,4 +149,3 @@ seasonality_canovahansen<-function(data, p0, p1, np, original=FALSE){ as.numeric(data), as.numeric(p0), as.numeric(p1), as.integer(np), as.logical(original)) return (jtest) } - diff --git a/R/timeseries.R b/R/timeseries.R index 64956a96..a3595e80 100644 --- a/R/timeseries.R +++ b/R/timeseries.R @@ -39,7 +39,7 @@ aggregate.default<-function(s, nfreq=1, jd_s<-.r2jd_tsdata(s) jd_agg<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/TsData;", "aggregate", jd_s, as.integer(nfreq), conversion, complete) if (is.jnull(jd_agg)){ - return (NULL); + return (NULL) } else{ return (.jd2r_tsdata(jd_agg)) @@ -85,7 +85,7 @@ clean_extremities<-function(s){ jd_scleaned<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/TsData;", "cleanExtremities", jd_s) if (is.jnull(jd_scleaned)){ - return (NULL); + return (NULL) } else{ return (.jd2r_tsdata(jd_scleaned)) @@ -167,7 +167,7 @@ ts_adjust.default<-function(s, method=c("LeapYear", "LengthOfPeriod"), reverse = jd_s<-.r2jd_tsdata(s) jd_st<-.jcall("jdplus/toolkit/base/r/modelling/Transformation", "Ljdplus/toolkit/base/api/timeseries/TsData;", "adjust", jd_s, method, as.logical(reverse)) if (is.jnull(jd_st)){ - return (NULL); + return (NULL) } else{ return (.jd2r_tsdata(jd_st)) diff --git a/R/utils.R b/R/utils.R index 52c97920..5ba1f602 100644 --- a/R/utils.R +++ b/R/utils.R @@ -63,5 +63,3 @@ likelihood<-function(nobs, neffectiveobs=NA, nparams=0, ll, adjustedll=NA, aic, aic=aic, aicc=aicc, bic=bic, bicc=bicc, ssq=ssq), class = "JD3_LIKELIHOOD")) } - - diff --git a/R/zzz.R b/R/zzz.R index f907af9c..db017814 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -34,5 +34,3 @@ NULL DATE_MAX<<-dateOf(9999, 12, 31) } - - diff --git a/rjd3toolkit.Rproj b/rjd3toolkit.Rproj index 038cf16b..b6949e1b 100644 --- a/rjd3toolkit.Rproj +++ b/rjd3toolkit.Rproj @@ -1,12 +1,12 @@ Version: 1.0 -RestoreWorkspace: Default -SaveWorkspace: Default -AlwaysSaveHistory: Default +RestoreWorkspace: No +SaveWorkspace: No +AlwaysSaveHistory: No EnableCodeIndexing: Yes UseSpacesForTab: Yes -NumSpacesForTab: 2 +NumSpacesForTab: 4 Encoding: UTF-8 RnwWeave: Sweave @@ -21,3 +21,5 @@ PackageInstallArgs: --no-multiarch --with-keep.source PackageBuildBinaryArgs: --no-multiarch PackageCheckArgs: --no-multiarch PackageRoxygenize: rd,collate,namespace,vignette + +UseNativePipeOperator: Yes