diff --git a/.Rbuildignore b/.Rbuildignore
index 89416d36..6e0d1c58 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -24,4 +24,4 @@ cran-comments.md
^revdep$
^reconf\.sh$
-^rjd3toolkit-java-deps\.xml$
+^pom\.xml$
diff --git a/.gitignore b/.gitignore
index de7c8b21..11424ef0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,3 +53,6 @@ rsconnect/
# Hidden file from mac-os
.DS_Store
+
+# produced README.html
+README.html
diff --git a/.lintr b/.lintr
index 3aa95131..15c4d39e 100644
--- a/.lintr
+++ b/.lintr
@@ -1,9 +1,6 @@
linters: linters_with_defaults(
indentation_linter = NULL,
- trailing_blank_lines_linter = NULL,
- trailing_whitespace_linter = NULL,
assignment_linter = NULL,
- whitespace_linter = NULL,
brace_linter = NULL,
infix_spaces_linter = NULL,
paren_body_linter = NULL,
@@ -12,9 +9,8 @@ linters: linters_with_defaults(
spaces_left_parentheses_linter = NULL,
commas_linter = NULL,
quotes_linter = NULL,
- spaces_inside_linter = NULL,
- vector_logic_linter = NULL,
- seq_linter = NULL,
+ #spaces_inside_linter = NULL,
+ #vector_logic_linter = NULL,
object_length_linter = NULL,
semicolon_linter = NULL,
cyclocomp_linter = NULL,
diff --git a/R/arima.R b/R/arima.R
index 3ed07b48..47445daf 100644
--- a/R/arima.R
+++ b/R/arima.R
@@ -16,7 +16,7 @@ NULL
#' @return A `"JD3_SARIMA"` model.
#' @export
sarima_model<-function(name="sarima", period, phi=NULL, d=0, theta=NULL, bphi=NULL, bd=0, btheta=NULL){
- return (structure(
+ return(structure(
list(name = name, period = period, phi = phi, d = d, theta = theta,
bphi = bphi, bd = bd, btheta = btheta), class="JD3_SARIMA"))
}
@@ -35,7 +35,7 @@ sarima_properties<-function(model, nspectrum=601, nacf=36){
jmodel<-.r2jd_sarima(model)
spectrum<-.jcall("jdplus/toolkit/base/r/arima/SarimaModels", "[D", "spectrum", jmodel, as.integer(nspectrum))
acf<-.jcall("jdplus/toolkit/base/r/arima/SarimaModels", "[D", "acf", jmodel, as.integer(nacf))
- return (list(acf=acf, spectrum=spectrum))
+ return(list(acf=acf, spectrum=spectrum))
}
@@ -58,7 +58,7 @@ sarima_properties<-function(model, nspectrum=601, nacf=36){
sarima_random<-function(model, length, stde=1, tdegree=0, seed=-1){
if (!inherits(model, "JD3_SARIMA"))
stop("Invalid model")
- return (.jcall("jdplus/toolkit/base/r/arima/SarimaModels", "[D", "random",
+ return(.jcall("jdplus/toolkit/base/r/arima/SarimaModels", "[D", "random",
as.integer(length),
as.integer(model$period),
.jarray(as.numeric(model$phi)),
@@ -91,8 +91,8 @@ sarima_decompose<-function(model, rmod=0, epsphi=0){
jmodel<-.r2jd_sarima(model)
jucm<-.jcall("jdplus/toolkit/base/r/arima/UcarimaModels", "Ljdplus/toolkit/base/core/ucarima/UcarimaModel;", "decompose",
jmodel, as.numeric(rmod), as.numeric(epsphi))
- if (is.jnull(jucm)) return (NULL)
- return (.jd2r_ucarima(jucm))
+ if (is.jnull(jucm)) return(NULL)
+ return(.jd2r_ucarima(jucm))
}
@@ -109,25 +109,25 @@ sarima_decompose<-function(model, rmod=0, epsphi=0){
#'
#' @examples
arima_model<-function(name="arima", ar=1, delta=1, ma=1, variance=1){
- return (structure(list(name=name, ar=ar, delta=delta, ma=ma, var=variance), class="JD3_ARIMA"))
+ return(structure(list(name=name, ar=ar, delta=delta, ma=ma, var=variance), class="JD3_ARIMA"))
}
.jd2r_doubleseq<-function(jobj, jprop){
jseq<-.jcall(jobj, "Ljdplus/toolkit/base/api/data/DoubleSeq;", jprop)
- return (.jcall(jseq, "[D", "toArray"))
+ return(.jcall(jseq, "[D", "toArray"))
}
.jd2r_sarima<-function(jsarima){
q<-.jcall("jdplus/toolkit/base/r/arima/SarimaModels", "[B", "toBuffer", jsarima)
rq<-RProtoBuf::read(modelling.SarimaModel, q)
- return (.p2r_sarima(rq))
+ return(.p2r_sarima(rq))
}
#' @export
#' @rdname jd3_utilities
.r2jd_sarima<-function(model){
- return (.jcall("jdplus/toolkit/base/r/arima/SarimaModels", "Ljdplus/toolkit/base/core/sarima/SarimaModel;", "of",
+ return(.jcall("jdplus/toolkit/base/r/arima/SarimaModels", "Ljdplus/toolkit/base/core/sarima/SarimaModel;", "of",
as.integer(model$period),
.jarray(as.numeric(model$phi)),
as.integer(model$d),
@@ -142,11 +142,11 @@ arima_model<-function(name="arima", ar=1, delta=1, ma=1, variance=1){
.jd2r_arima<-function(jarima){
q<-.jcall("jdplus/toolkit/base/r/arima/ArimaModels", "[B", "toBuffer", jarima)
rq<-RProtoBuf::read(modelling.ArimaModel, q)
- return (.p2r_arima(rq))
+ return(.p2r_arima(rq))
}
.r2jd_arima<-function(model){
- return (.jcall("jdplus/toolkit/base/r/arima/ArimaModels", "Ljdplus/toolkit/base/core/arima/ArimaModel;", "of",
+ return(.jcall("jdplus/toolkit/base/r/arima/ArimaModels", "Ljdplus/toolkit/base/core/arima/ArimaModel;", "of",
.jarray(as.numeric(model$ar)),
.jarray(as.numeric(model$delta)),
.jarray(as.numeric(model$ma)),
@@ -176,13 +176,13 @@ arima_model<-function(name="arima", ar=1, delta=1, ma=1, variance=1){
#' @export
arima_sum<-function(...){
components<-list(...)
- return (arima_lsum(components))
+ return(arima_lsum(components))
}
arima_lsum<-function(components){
q<-.jarray(lapply(components, .r2jd_arima), "jdplus/toolkit/base/core/arima/ArimaModel")
jsum<-.jcall("jdplus/toolkit/base/r/arima/ArimaModels", "Ljdplus/toolkit/base/core/arima/ArimaModel;", "sum", q)
- return (.jd2r_arima(jsum))
+ return(.jd2r_arima(jsum))
}
#' Remove an arima model from an existing one
@@ -205,7 +205,7 @@ arima_difference<-function(left, right, simplify=TRUE){
jleft<-.r2jd_arima(left)
jright<-.r2jd_arima(right)
jdiff<-.jcall(jleft, "Ljdplus/toolkit/base/core/arima/ArimaModel;", "minus", jright, as.logical(simplify))
- return (.jd2r_arima(jdiff))
+ return(.jd2r_arima(jdiff))
}
@@ -223,7 +223,7 @@ arima_properties<-function(model, nspectrum=601, nacf=36){
jmodel<-.r2jd_arima(model)
spectrum<-.jcall("jdplus/toolkit/base/r/arima/ArimaModels", "[D", "spectrum", jmodel, as.integer(nspectrum))
acf<-.jcall("jdplus/toolkit/base/r/arima/ArimaModels", "[D", "acf", jmodel, as.integer(nacf))
- return (list(acf=acf, spectrum=spectrum))
+ return(list(acf=acf, spectrum=spectrum))
}
#' Title
@@ -242,13 +242,13 @@ ucarima_model<-function(model=NULL, components, complements=NULL, checkmodel=FAL
else if (! is(model, "JD3_ARIMA") && ! is(model, "JD3_SARIMA")) stop("Invalid model")
# TODO: checkmodel
- return (structure(list(model=model, components=components, complements=complements), class="JD3_UCARIMA"))
+ return(structure(list(model=model, components=components, complements=complements), class="JD3_UCARIMA"))
}
.r2jd_ucarima<-function(ucm){
jmodel<-.r2jd_arima(ucm$model)
jcmps<-.jarray(lapply(ucm$components, .r2jd_arima), "jdplus/toolkit/base/core/arima/ArimaModel")
- return (.jcall("jdplus/toolkit/base/r/arima/UcarimaModels", "Ljdplus/toolkit/base/core/ucarima/UcarimaModel;", "of", jmodel, jcmps))
+ return(.jcall("jdplus/toolkit/base/r/arima/UcarimaModels", "Ljdplus/toolkit/base/core/ucarima/UcarimaModel;", "of", jmodel, jcmps))
}
#' @export
@@ -256,10 +256,10 @@ ucarima_model<-function(model=NULL, components, complements=NULL, checkmodel=FAL
.jd2r_ucarima<-function(jucm){
# model<-.jcall(jucm, "Ljdplus/toolkit/base/core/arima/ArimaModel;", "sum")
# jcmps<-.jcall(jucm, "[Ljdplus/toolkit/base/core/arima/ArimaModel;", "getComponents")
-# return (ucarima_model(.jd2r_arima(model), lapply(jcmps, .jd2r_arima)))
+# return(ucarima_model(.jd2r_arima(model), lapply(jcmps, .jd2r_arima)))
q<-.jcall("jdplus/toolkit/base/r/arima/UcarimaModels", "[B", "toBuffer", jucm)
rq<-RProtoBuf::read(modelling.UcarimaModel, q)
- return (.p2r_ucarima(rq))
+ return(.p2r_ucarima(rq))
}
@@ -284,7 +284,7 @@ ucarima_wk<-function(ucm, cmp, signal=TRUE, nspectrum=601, nwk=300){
wk<-.jcall("jdplus/toolkit/base/r/arima/UcarimaModels", "[D", "filter", jwk, as.integer(nwk))
gain<-.jcall("jdplus/toolkit/base/r/arima/UcarimaModels", "[D", "gain", jwk, as.integer(nspectrum))
- return (structure(list(spectrum=spectrum, filter=wk, gain2=gain*gain), class="JD3_UCARIMA_WK"))
+ return(structure(list(spectrum=spectrum, filter=wk, gain2=gain*gain), class="JD3_UCARIMA_WK"))
}
#' Title
@@ -300,7 +300,7 @@ ucarima_canonical<-function(ucm, cmp=0, adjust=TRUE){
jucm<-.r2jd_ucarima(ucm)
jnucm<-.jcall("jdplus/toolkit/base/r/arima/UcarimaModels", "Ljdplus/toolkit/base/core/ucarima/UcarimaModel;", "doCanonical",
jucm, as.integer(cmp-1), as.logical(adjust))
- return (.jd2r_ucarima(jnucm))
+ return(.jd2r_ucarima(jnucm))
}
#' Estimate UCARIMA Model
@@ -317,7 +317,7 @@ ucarima_estimate<-function(x, ucm, stdev=TRUE){
jucm<-.r2jd_ucarima(ucm)
jcmps<-.jcall("jdplus/toolkit/base/r/arima/UcarimaModels", "Ljdplus/toolkit/base/api/math/matrices/Matrix;", "estimate",
as.numeric(x), jucm, as.logical(stdev))
- return (.jd2r_matrix(jcmps))
+ return(.jd2r_matrix(jcmps))
}
#' Estimate SARIMA Model
@@ -373,7 +373,7 @@ sarima_estimate<-function(x, order=c(0,0,0), seasonal = list(order=c(0,0,0), per
sprintf("btheta(%i)", seq_len(seasonal$order[3])))
res$orders <- list(order = order, seasonal = seasonal)
class(res) <- c("JD3_SARIMA_ESTIMATE", "JD3_REGARIMA_RSLTS")
- return (res)
+ return(res)
}
#' Title
@@ -402,5 +402,5 @@ sarima_hannan_rissanen<-function(x, order=c(0,0,0), seasonal = list(order=c(0,0,
seasonal$period <- frequency(x)
jmodel<-.jcall("jdplus/toolkit/base/r/arima/SarimaModels", "Ljdplus/toolkit/base/core/sarima/SarimaModel;", "hannanRissanen",
as.numeric(x), as.integer(order), as.integer(seasonal$period), as.integer(seasonal$order), as.character(initialization), as.logical(biasCorrection), as.logical(finalCorrection))
- return (.jd2r_sarima(jmodel))
+ return(.jd2r_sarima(jmodel))
}
diff --git a/R/calendars.R b/R/calendars.R
index 40c5f743..70c379ef 100644
--- a/R/calendars.R
+++ b/R/calendars.R
@@ -25,7 +25,7 @@ SINGLEDAY<-'JD3_SINGLEDAY'
}
vp$start<-pstart
vp$end<-pend
- return (vp)
+ return(vp)
}
@@ -42,9 +42,9 @@ SINGLEDAY<-'JD3_SINGLEDAY'
else
end<-as.Date(sprintf("%04i-%02i-%02i", pend$year, pend$month, pend$day))
if (is.null(start) && is.null(end))
- return (NULL)
+ return(NULL)
else
- return (list(start=start, end=end))
+ return(list(start=start, end=end))
}
.length_ts <- function(s){
@@ -79,11 +79,11 @@ SINGLEDAY<-'JD3_SINGLEDAY'
#' More information on calendar correction in JDemetra+ online documentation:
#' \url{https://jdemetra-new-documentation.netlify.app/a-calendar-correction}
fixed_day<-function(month, day, weight=1, validity=NULL){
- return (structure(list(month=month, day=day, weight=weight, validity=validity), class=c(FIXEDDAY, HOLIDAY)))
+ return(structure(list(month=month, day=day, weight=weight, validity=validity), class=c(FIXEDDAY, HOLIDAY)))
}
.p2r_fixedday<-function(p){
- return (structure(list(month=p$month, day=p$day, weight=p$weight, validity=.p2r_validityPeriod(p$validity)), class=FIXEDDAY))
+ return(structure(list(month=p$month, day=p$day, weight=p$weight, validity=.p2r_validityPeriod(p$validity)), class=FIXEDDAY))
}
.r2p_fixedday<-function(r){
@@ -96,7 +96,7 @@ fixed_day<-function(month, day, weight=1, validity=NULL){
else
fd$validity<-.r2p_validityPeriod(r$validity$start, r$validity$end)
- return (fd)
+ return(fd)
}
@@ -125,11 +125,11 @@ fixed_day<-function(month, day, weight=1, validity=NULL){
#' \url{https://jdemetra-new-documentation.netlify.app/a-calendar-correction}
#'
fixed_week_day<-function(month, week, dayofweek, weight=1, validity=NULL){
- return (structure(list(month=month, week=week, dayofweek=dayofweek, weight=weight, validity=validity), class=c(FIXEDWEEKDAY, HOLIDAY)))
+ return(structure(list(month=month, week=week, dayofweek=dayofweek, weight=weight, validity=validity), class=c(FIXEDWEEKDAY, HOLIDAY)))
}
.p2r_fixedweekday<-function(p){
- return (fixed_week_day(p$month, week=p$position, dayofweek=p$weekday, weight=p$weight, validity=.p2r_validityPeriod(p$validity)))
+ return(fixed_week_day(p$month, week=p$position, dayofweek=p$weekday, weight=p$weight, validity=.p2r_validityPeriod(p$validity)))
}
.r2p_fixedweekday<-function(r){
@@ -142,7 +142,7 @@ fixed_week_day<-function(month, week, dayofweek, weight=1, validity=NULL){
fd$validity<-.r2p_validityPeriod(NULL, NULL)
else
fd$validity<-.r2p_validityPeriod(r$validity$start, r$validity$end)
- return (fd)
+ return(fd)
}
#' Set a Holiday on an Easter related day
@@ -168,11 +168,11 @@ fixed_week_day<-function(month, week, dayofweek, weight=1, validity=NULL){
#'
#' @export
easter_day<-function(offset, julian=FALSE, weight=1, validity=NULL){
- return (structure(list(offset=offset, julian=julian, weight=weight, validity=validity), class=c(EASTERDAY, HOLIDAY)))
+ return(structure(list(offset=offset, julian=julian, weight=weight, validity=validity), class=c(EASTERDAY, HOLIDAY)))
}
.p2r_easterday<-function(p){
- return (easter_day(p$offset, p$julian, p$weight, .p2r_validityPeriod(p$validity)))
+ return(easter_day(p$offset, p$julian, p$weight, .p2r_validityPeriod(p$validity)))
}
.r2p_easterday<-function(r){
@@ -184,7 +184,7 @@ easter_day<-function(offset, julian=FALSE, weight=1, validity=NULL){
fd$validity<-.r2p_validityPeriod(NULL, NULL)
else
fd$validity<-.r2p_validityPeriod(r$validity$start, r$validity$end)
- return (fd)
+ return(fd)
}
@@ -205,18 +205,18 @@ easter_day<-function(offset, julian=FALSE, weight=1, validity=NULL){
#'
#' @export
single_day<-function(date, weight=1){
- return (structure(list(date=date, weight=weight), class=c(SINGLEDAY, HOLIDAY)))
+ return(structure(list(date=date, weight=weight), class=c(SINGLEDAY, HOLIDAY)))
}
.p2r_singleday<-function(p){
- return (single_day(.p2r_date(p$date), p$weight))
+ return(single_day(.p2r_date(p$date), p$weight))
}
.r2p_singleday<-function(r){
sd<-jd3.SingleDate$new()
sd$date<-parseDate(r$date)
sd$weight<-r$weight
- return (sd)
+ return(sd)
}
@@ -265,11 +265,11 @@ single_day<-function(date, weight=1){
#' More information on calendar correction in JDemetra+ online documentation:
#' \url{https://jdemetra-new-documentation.netlify.app/a-calendar-correction}
special_day<-function(event, offset=0, weight=1, validity=NULL){
- return (structure(list(event=event, offset=offset, weight=weight, validity=validity), class=c(SPECIALDAY, HOLIDAY)))
+ return(structure(list(event=event, offset=offset, weight=weight, validity=validity), class=c(SPECIALDAY, HOLIDAY)))
}
.p2r_specialday<-function(p){
- return (special_day(.enum_extract(jd3.CalendarEvent, p$event), p$offset, p$weight, .p2r_validityPeriod(p$validity)))
+ return(special_day(.enum_extract(jd3.CalendarEvent, p$event), p$offset, p$weight, .p2r_validityPeriod(p$validity)))
}
.r2p_specialday<-function(r){
@@ -281,7 +281,7 @@ special_day<-function(event, offset=0, weight=1, validity=NULL){
pd$validity<-.r2p_validityPeriod(NULL, NULL)
else
pd$validity<-.r2p_validityPeriod(r$validity$start, r$validity$end)
- return (pd)
+ return(pd)
}
#' @export
@@ -290,7 +290,7 @@ special_day<-function(event, offset=0, weight=1, validity=NULL){
bytes<-pcalendar$serialize(NULL)
jcal<-.jcall("jdplus/toolkit/base/r/calendar/Calendars", "Ljdplus/toolkit/base/api/timeseries/calendars/Calendar;",
"calendarOf", bytes)
- return (jcal)
+ return(jcal)
}
.group_names <- function(x, contrasts = TRUE){
@@ -346,7 +346,7 @@ td<-function(frequency, start, length, s, groups=c(1,2,3,4,5,6,0), contrasts=TRU
"td", jdom, igroups, contrasts)
data <- .jd2r_matrix(jm)
data <- .group_names(data, contrasts = contrasts)
- return (ts(data, start = start, frequency = frequency))
+ return(ts(data, start = start, frequency = frequency))
}
#' Daily calendar regressors corresponding to holidays
@@ -413,7 +413,7 @@ holidays <- function(calendar,
res <- .jd2r_matrix(jm)
rownames(res) <- as.character(seq(as.Date(start), length.out = nrow(res), by = "days"))
colnames(res) <- names(calendar$days)
- return (res)
+ return(res)
}
#' Display Long-term means for a set of calendar regressors
@@ -451,7 +451,7 @@ long_term_mean <-function(calendar,frequency,groups=c(1,2,3,4,5,6,0), holiday=7)
jm<-.jcall("jdplus/toolkit/base/r/calendar/Calendars", "Ljdplus/toolkit/base/api/math/matrices/Matrix;",
"longTermMean", jcal, as.integer(frequency), as.integer(groups), as.integer(holiday))
res <- .jd2r_matrix(jm)
- return (.group_names(res, contrasts = FALSE))
+ return(.group_names(res, contrasts = FALSE))
}
#' Display Easter Sunday dates in given period
@@ -474,7 +474,7 @@ long_term_mean <-function(calendar,frequency,groups=c(1,2,3,4,5,6,0), holiday=7)
#' easter_dates(2018, 2023)
easter_dates<-function(year0, year1, julian = FALSE){
dates<-.jcall("jdplus/toolkit/base/r/calendar/Calendars", "[S", "easter", as.integer(year0), as.integer(year1), as.logical(julian))
- return (sapply(dates, as.Date))
+ return(sapply(dates, as.Date))
}
#' Trading day Regressor for Stock series
@@ -502,20 +502,20 @@ stock_td<-function(frequency, start, length, s, w = 31){
jm<-.jcall("jdplus/toolkit/base/r/modelling/Variables", "Ljdplus/toolkit/base/api/math/matrices/Matrix;", "stockTradingDays", jdom, as.integer(w))
data <- .jd2r_matrix(jm)
colnames(data) <- c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
- return (ts(data, frequency = frequency, start= start))
+ return(ts(data, frequency = frequency, start= start))
}
.r2p_holiday<-function(r){
- if (is(r, SPECIALDAY)){return (.r2p_specialday(r))}
- if (is(r, FIXEDDAY)){return (.r2p_fixedday(r))}
- if (is(r, EASTERDAY)){return (.r2p_easterday(r))}
- if (is(r, FIXEDWEEKDAY)){return (.r2p_fixedweekday(r))}
- if (is(r, SINGLEDAY)){return (.r2p_singleday(r))}
- return (NULL)
+ if (is(r, SPECIALDAY)){return(.r2p_specialday(r))}
+ if (is(r, FIXEDDAY)){return(.r2p_fixedday(r))}
+ if (is(r, EASTERDAY)){return(.r2p_easterday(r))}
+ if (is(r, FIXEDWEEKDAY)){return(.r2p_fixedweekday(r))}
+ if (is(r, SINGLEDAY)){return(.r2p_singleday(r))}
+ return(NULL)
}
.p2r_calendar<-function(p){
- return (structure(
+ return(structure(
list(days=c(lapply(p$fixed_days, function(z) .p2r_fixedday(z)),
lapply(p$fixed_week_days, function(z) .p2r_fixedweekday(z)),
lapply(p$easter_related_days, function(z) .p2r_easterday(z)),
@@ -547,7 +547,7 @@ stock_td<-function(frequency, start, length, s, w = 31){
p$single_dates<-lapply(r$days[sel], function(z) .r2p_singleday(z))
}
p$mean_correction<-r$mean_correction
- return (p)
+ return(p)
}
#' Create a Chained Calendar
@@ -574,7 +574,7 @@ stock_td<-function(frequency, start, length, s, w = 31){
#'
#' @export
chained_calendar<-function(calendar1, calendar2, break_date){
- return (structure(list(
+ return(structure(list(
calendar1=calendar1,
calendar2=calendar2,
break_date=break_date
@@ -582,7 +582,7 @@ chained_calendar<-function(calendar1, calendar2, break_date){
}
.p2r_chainedcalendar<-function(p){
- return (chained_calendar(p$calendar1, p$calendar2, .p2r_date(p$break_date)))
+ return(chained_calendar(p$calendar1, p$calendar2, .p2r_date(p$break_date)))
}
.r2p_chainedcalendar<-function(r){
@@ -590,7 +590,7 @@ chained_calendar<-function(calendar1, calendar2, break_date){
pc$calendar1<-.r2p_calendardef(r$calendar1)
pc$calendar2<-.r2p_calendardef(r$calendar2)
pc$break_date<-parseDate(r$break_date)
- return (pc)
+ return(pc)
}
#' Create a Composite Calendar
@@ -621,29 +621,29 @@ weighted_calendar<-function(calendars, weights){
checkmate::assertNumeric(weights)
if (length(calendars) != length(weights)) stop("Calendars and weights should have the same length")
- return (structure(list(calendars=calendars, weights=weights), class=c('JD3_WEIGHTEDCALENDAR', 'JD3_CALENDARDEFINITION')))
+ return(structure(list(calendars=calendars, weights=weights), class=c('JD3_WEIGHTEDCALENDAR', 'JD3_CALENDARDEFINITION')))
}
.p2r_wcalendar<-function(p){
- calendars<-sapply(p, function(item){return (item$calendar)})
- weights<-sapply(p, function(item){return (item$weights)})
- return (weighted_calendar(calendars, weights))
+ calendars<-sapply(p, function(item){return(item$calendar)})
+ weights<-sapply(p, function(item){return(item$weights)})
+ return(weighted_calendar(calendars, weights))
}
.r2p_wcalendar<-function(r){
pwc<-jd3.WeightedCalendar$new()
n<-length(r$calendars)
- pwc$items<-lapply(1:n, function(i){return (list(calendar=r$calendars[[i]], weight=r$weights[i]))})
+ pwc$items<-lapply(1:n, function(i){return(list(calendar=r$calendars[[i]], weight=r$weights[i]))})
pwc
}
.p2r_calendardef<-function(p){
- if (p$has('calendar')) return (.p2r_calendar(p$calendar))
- if (p$has('chained_calendar')) return (.p2r_chainedcalendar(p$chained_calendar))
- if (p$has('weighted_calendar')) return (.p2r_wcalendar(p$weighted_calendar))
- return (NULL)
+ if (p$has('calendar')) return(.p2r_calendar(p$calendar))
+ if (p$has('chained_calendar')) return(.p2r_chainedcalendar(p$chained_calendar))
+ if (p$has('weighted_calendar')) return(.p2r_wcalendar(p$weighted_calendar))
+ return(NULL)
}
.r2p_calendardef<-function(r){
@@ -651,7 +651,7 @@ weighted_calendar<-function(calendars, weights){
if (is(r, 'JD3_CALENDAR')){p$calendar<-.r2p_calendar(r)}
else if (is(r, 'JD3_CHAINEDCALENDAR')){p$chained_calendar<-.r2p_chainedcalendar(r)}
else if (is(r, 'JD3_WEIGHTEDCALENDAR')){p$weighted_calendar<-.r2p_wcalendar(r)}
- return (p)
+ return(p)
}
@@ -692,7 +692,7 @@ weighted_calendar<-function(calendars, weights){
#' @export
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')))
+ return(structure(list(days=days, mean_correction=mean_correction), class=c('JD3_CALENDAR', 'JD3_CALENDARDEFINITION')))
}
#' Trading day regressors with pre-defined holidays
@@ -747,7 +747,7 @@ calendar_td<-function(calendar,frequency, start, length, s, groups=c(1,2,3,4,5,6
"htd", jcal, jdom, as.integer(groups), as.integer(holiday), contrasts)
output <- .jd2r_matrix(jm)
output <- .group_names(output, contrasts = contrasts)
- return (ts(output, start = start, frequency = frequency))
+ return(ts(output, start = start, frequency = frequency))
}
#' Calendars Print Methods
diff --git a/R/calendarts.R b/R/calendarts.R
index 998abd64..569f22fb 100644
--- a/R/calendarts.R
+++ b/R/calendarts.R
@@ -12,12 +12,12 @@
#' jobj<-r2jd_calendarts(obs)
r2jd_calendarts<-function(calendarobs){
if (is.null(calendarobs) || !is.list(calendarobs)){
- return (NULL)
+ return(NULL)
}
starts<-sapply(calendarobs, function(z){as.character(z$start)})
ends<-sapply(calendarobs, function(z){as.character(z$end)})
values<-sapply(calendarobs, function(z){as.numeric(z$value)})
jts<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/CalendarTimeSeries;", "of",
.jarray(starts, "Ljava/lang/String;"), .jarray(ends, "Ljava/lang/String;"), .jarray(values))
- return (jts)
+ return(jts)
}
diff --git a/R/decomposition.R b/R/decomposition.R
index b29631e7..39781205 100644
--- a/R/decomposition.R
+++ b/R/decomposition.R
@@ -30,7 +30,7 @@ sadecomposition<-function(y, sa, t, s, i, mul){
if (! is.ts(sa))stop("Invalid SA decomposition")
if (! is.ts(t))stop("Invalid SA decomposition")
- return (structure(list(series=y, sa=sa, trend=t, seas=s, irr=i, multiplicative=mul), class=c("JD3_SADECOMPOSITION", "JD3")))
+ return(structure(list(series=y, sa=sa, trend=t, seas=s, irr=i, multiplicative=mul), class=c("JD3_SADECOMPOSITION", "JD3")))
}
#' @rdname sa_decomposition
diff --git a/R/differencing.R b/R/differencing.R
index 0c8bf14e..80df0432 100644
--- a/R/differencing.R
+++ b/R/differencing.R
@@ -3,11 +3,11 @@ NULL
.p2r_differencing<-function(p){
if (is.null(p)){
- return (NULL)
+ return(NULL)
} else{
- del<-sapply(p$differences, function(z){(return (c(z$lag,z$order)))})
+ del<-sapply(p$differences, function(z){(return(c(z$lag,z$order)))})
del<-`rownames<-`(del, c("lag", "order"))
- return (list(ddata=p$stationary_series,
+ return(list(ddata=p$stationary_series,
mean=p$mean_correction,
differences=del))
}
@@ -45,7 +45,7 @@ do_stationary<-function(data, period){
res <- .p2r_differencing(p)
if (is.ts(data))
res$ddata <- ts(res$ddata, end = end(data), frequency = frequency(data))
- return (res)
+ return(res)
}
#' Automatic differencing
@@ -80,7 +80,7 @@ differencing_fast<-function(data, period, mad=TRUE, centile=90, k=1.2){
res <- .p2r_differencing(p)
if (is.ts(data))
res$ddata <- ts(res$ddata, end = end(data), frequency = frequency(data))
- return (res)
+ return(res)
}
#' Differencing of a series
@@ -104,7 +104,7 @@ differences.default<-function(data, lags=1, mean=TRUE){
as.numeric(data), .jarray(as.integer(lags)), mean)
if (is.ts(data))
res <- ts(res, end = end(data), frequency = frequency(data))
- return (res)
+ return(res)
}
#' @export
differences.matrix<-function(data, lags=1, mean=TRUE){
@@ -179,7 +179,7 @@ differences.data.frame<-function(data, lags=1, mean=TRUE){
rangemean_tstat<-function(data, period=0, groupsize = 0, trim = 0){
if (is.ts(data) && missing(period))
period <- frequency(data)
- return (.jcall("jdplus/toolkit/base/r/modelling/AutoModelling", "D", "rangeMean",
+ return(.jcall("jdplus/toolkit/base/r/modelling/AutoModelling", "D", "rangeMean",
as.numeric(data), as.integer(period), as.integer(groupsize), as.integer(trim)))
}
diff --git a/R/display.R b/R/display.R
index 36ee39d4..1e060fd0 100644
--- a/R/display.R
+++ b/R/display.R
@@ -34,7 +34,7 @@ print.JD3_UCARIMA<-function(x,...){
.arima_node<-function(p,d,q){
s<-paste(p,d,q,sep=',')
- return (paste0('(', s, ')'))
+ return(paste0('(', s, ')'))
}
#' @rdname jd3_print
@@ -365,7 +365,7 @@ summary.JD3_SARIMA_ESTIMATE <-function(object, ...){
xregs = .regarima_coef_table(object, ...),
likelihood = likelihood)
class(res) <- "summary.JD3_REGARIMA_RSLTS"
- return (res)
+ return(res)
}
#' @export
print.summary.JD3_REGARIMA_RSLTS <- function(x, digits = max(3L, getOption("digits") - 3L), signif.stars = getOption("show.signif.stars"), ...){
@@ -387,7 +387,7 @@ print.summary.JD3_REGARIMA_RSLTS <- function(x, digits = max(3L, getOption("dig
#' @export
diagnostics.JD3_REGARIMA_RSLTS<-function(x, ...){
- if (is.null(x)) return (NULL)
+ if (is.null(x)) return(NULL)
residuals_test = x$diagnostics
residuals_test = data.frame(Statistic = sapply(residuals_test, function(test) test[["value"]]),
P.value = sapply(residuals_test, function(test) test[["pvalue"]]),
diff --git a/R/jd2r.R b/R/jd2r.R
index b18a1366..dcdebe79 100644
--- a/R/jd2r.R
+++ b/R/jd2r.R
@@ -5,12 +5,12 @@ NULL
.jd2r_test<-function(jtest){
if (is.jnull(jtest))
- return (NULL)
+ return(NULL)
else{
desc<-.jcall(jtest, "S", "getDescription")
val<-.jcall(jtest, "D", "getValue")
pval<-.jcall(jtest, "D", "getPvalue")
- return (statisticaltest(val, pval, desc))
+ return(statisticaltest(val, pval, desc))
}
}
@@ -18,7 +18,7 @@ NULL
#' @rdname jd3_utilities
.r2jd_tsdata<-function(s){
if (is.null(s)){
- return (NULL)
+ return(NULL)
}
freq<-frequency(s)
start<-start(s)
@@ -37,12 +37,12 @@ NULL
#' @rdname jd3_utilities
.jd2r_tsdata<-function(s){
if (is.jnull(s)){
- return (NULL)
+ return(NULL)
}
jx<-.jcall(s, "Ljdplus/toolkit/base/api/data/DoubleSeq;", "getValues")
x<-.jcall(jx, "[D", "toArray")
- if (is.null(x)) return (NULL)
- if (length(x) == 0) return (NULL)
+ if (is.null(x)) return(NULL)
+ if (length(x) == 0) return(NULL)
pstart<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "[I", "startPeriod", s)
ts(x,start=pstart[2:3], frequency=pstart[1])
}
@@ -51,78 +51,83 @@ NULL
#' @rdname jd3_utilities
.jd2r_mts<-function(s){
if (is.jnull(s)){
- return (NULL)
+ return(NULL)
}
jx<-.jcall(s, "Ljdplus/toolkit/base/api/math/matrices/Matrix;", "toMatrix")
x<-.jd2r_matrix(jx)
- if (is.jnull(x)) return (NULL)
+ if (is.jnull(x)) return(NULL)
pstart<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "[I", "startPeriod", s)
ts(x,start=pstart[2:3], frequency=pstart[1])
}
.extract_jts<-function(collection, index){
- js<- .jcall(collection, "Ljdplus/toolkit/base/api/timeseries/Ts;", "get", as.integer(index-1) )
- return (js)
+ js<- .jcall(collection, "Ljdplus/toolkit/base/api/timeseries/Ts;", "get", as.integer(index-1))
+ return(js)
}
#' @export
#' @rdname jd3_utilities
.jd2r_lts<-function(s){
- if (is.jnull(s)){
- return (NULL)
- }
- size<-.jcall(s, "I", "length")
- if (size == 0)
- return (NULL)
- all <- lapply(1:size, function(idx){ return (.jd2r_ts(.extract_jts(s, idx)))} )
- return (all)
+ if (is.jnull(s)){
+ return(NULL)
+ }
+ size<-.jcall(s, "I", "length")
+ if (size == 0)
+ return(NULL)
+ all <- lapply(
+ X = 1:size,
+ FUN = function(idx){
+ return(.jd2r_ts(.extract_jts(s, idx)))
+ }
+ )
+ return(all)
}
#' @export
#' @rdname jd3_utilities
.jd2r_matrix<-function(s){
if (is.jnull(s)){
- return (NULL)
+ return(NULL)
}
nr<-.jcall(s, "I", "getRowsCount")
nc<-.jcall(s, "I", "getColumnsCount")
d<-.jcall(s, "[D", "toArray")
- return (array(d, dim=c(nr, nc)))
+ return(array(d, dim=c(nr, nc)))
}
#' @export
#' @rdname jd3_utilities
.r2jd_matrix<-function(s){
if (is.null(s))
- return (.jnull("jdplus/toolkit/base/api/math/matrices/Matrix"))
+ return(.jnull("jdplus/toolkit/base/api/math/matrices/Matrix"))
if (!is.matrix(s)){
s<-matrix(s, nrow=length(s), ncol=1)
}
sdim<-dim(s)
- return (.jcall("jdplus/toolkit/base/api/math/matrices/Matrix","Ljdplus/toolkit/base/api/math/matrices/Matrix;", "of", as.double(s), as.integer(sdim[1]), as.integer(sdim[2])))
+ return(.jcall("jdplus/toolkit/base/api/math/matrices/Matrix","Ljdplus/toolkit/base/api/math/matrices/Matrix;", "of", as.double(s), as.integer(sdim[1]), as.integer(sdim[2])))
}
.j2r_ldt<-function(ldt){
if (is.jnull(ldt))
- return (NULL)
+ return(NULL)
dt<-.jcall(ldt, "Ljava/time/LocalDate;", "toLocalDate")
- return (as.Date(.jcall(dt, "S", "toString")))
+ return(as.Date(.jcall(dt, "S", "toString")))
}
.j2r_dt<-function(dt){
if (is.jnull(dt))
- return (NULL)
- return (as.Date(.jcall(dt, "S", "toString")))
+ return(NULL)
+ return(as.Date(.jcall(dt, "S", "toString")))
}
.r2j_dt<-function(dt){
jdt<-.jnew("java/lang/String", as.character(dt))
- return (.jcall("java/time/LocalDate", "Ljava/time/LocalDate;", "parse", .jcast(jdt, "java/lang/CharSequence")))
+ return(.jcall("java/time/LocalDate", "Ljava/time/LocalDate;", "parse", .jcast(jdt, "java/lang/CharSequence")))
}
.r2j_ldt<-function(dt){
jdt<-.r2j_dt(dt)
- return (.jcall(jdt, "Ljava/time/LocalDateTime;", "atStartOfDay"))
+ return(.jcall(jdt, "Ljava/time/LocalDateTime;", "atStartOfDay"))
}
.jd2r_parameters <- function(jparams){
@@ -131,7 +136,7 @@ NULL
param<-.jcastToArray(jparams)
len <- length(param)
if (len==0)
- return (NULL)
+ return(NULL)
param_name <- deparse(substitute(jparams))
Type <- sapply(param, function(x) .jcall(.jcall(x, "Ljdplus/toolkit/base/api/data/ParameterType;", "getType"), "S", "name"))
Value <- sapply(param, function(x) .jcall(x, "D", "getValue"))
@@ -145,7 +150,7 @@ NULL
#' @export
#' @rdname jd3_utilities
.jdomain<-function(period, start, end){
- if (period == 0)return (.jnull("jdplus/toolkit/base/api/timeseries/TsDomain"))
+ if (period == 0)return(.jnull("jdplus/toolkit/base/api/timeseries/TsDomain"))
if (is.null(start))
start<-c(1900,1)
if (is.null(end))
@@ -153,5 +158,5 @@ NULL
n<-period*(end[1]-start[1])+end[2]-start[2]
jdom<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/TsDomain;", "of"
, as.integer(period), as.integer(start[1]), as.integer(start[2]), as.integer(n))
- return (jdom)
+ return(jdom)
}
diff --git a/R/jd3rslts.R b/R/jd3rslts.R
index bb9bb649..aa81e6a0 100644
--- a/R/jd3rslts.R
+++ b/R/jd3rslts.R
@@ -141,7 +141,7 @@
.proc_dictionary<-function(name){
jmapping<-.jcall(name, "Ljdplus/toolkit/base/api/information/InformationMapping;", "getMapping")
jmap<-.jnew("java/util/LinkedHashMap")
- .jcall(jmapping, "V", "fillDictionary", .jnull("java/lang/String"), .jcast(jmap, "java/util/Map"), TRUE )
+ .jcall(jmapping, "V", "fillDictionary", .jnull("java/lang/String"), .jcast(jmap, "java/util/Map"), TRUE)
jkeys<-.jcall(jmap, "Ljava/util/Set;", "keySet")
size<-.jcall(jkeys, "I", "size")
keys<-array(dim=size)
diff --git a/R/modellingcontext.R b/R/modellingcontext.R
index 9e78bbdd..364dd772 100644
--- a/R/modellingcontext.R
+++ b/R/modellingcontext.R
@@ -16,7 +16,7 @@ JD3_TSCOLLECTION<-'JD3_TSCOLLECTION'
#'
#' @examples
tsmoniker<-function(source, id){
- return (structure(list(source=source, id=id), class=c(JD3_TSMONIKER)))
+ return(structure(list(source=source, id=id), class=c(JD3_TSMONIKER)))
}
#' @export
@@ -25,14 +25,14 @@ tsmoniker<-function(source, id){
p<-jd3.TsMoniker$new()
p$source<-r$source
p$id<-r$id
- return (p)
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.p2r_moniker<-function(p){
- if (is.null(p)) return (NULL)
- return (tsmoniker(p$source, p$id))
+ if (is.null(p)) return(NULL)
+ return(tsmoniker(p$source, p$id))
}
@@ -43,20 +43,20 @@ tsmoniker<-function(source, id){
p$name<-name
if (is.ts(r)) p$data<-.r2p_tsdata(r)
else if (is(r, JD3_DYNAMICTS)) p$dynamic_data<-.r2p_dynamic_ts(r)
- else return (NULL)
- return (p)
+ else return(NULL)
+ return(p)
}
dynamic_ts<-function(moniker, data){
- return (structure(list(moniker=moniker, data=data), class=c(JD3_DYNAMICTS)))
+ return(structure(list(moniker=moniker, data=data), class=c(JD3_DYNAMICTS)))
}
.ts<-function(name, moniker, metadata, data){
- return (structure(list(name=name, moniker=moniker, metadata=metadata, data=data), class=c(JD3_TS)))
+ return(structure(list(name=name, moniker=moniker, metadata=metadata, data=data), class=c(JD3_TS)))
}
.tscollection<-function(name, moniker, metadata, series){
- return (structure(list(name=name, moniker=moniker, metadata=metadata, series=series), class=c(JD3_TSCOLLECTION)))
+ return(structure(list(name=name, moniker=moniker, metadata=metadata, series=series), class=c(JD3_TSCOLLECTION)))
}
#' @export
@@ -67,34 +67,34 @@ dynamic_ts<-function(moniker, data){
lv<-lapply(p, function(v){return(v$value)})
ns<-sapply(p, function(v){return(v$key)})
names(lv)<-ns
- return (lv)
+ return(lv)
}
- return (NULL)
+ return(NULL)
}
.entry<-function(key, value, type){
p<-type$new()
p$key<-key
p$value<-value
- return (p)
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.r2p_metadata<-function(r, type){
n<-names(r)
- pm<-lapply(n, function(item){ return (.entry(item, r[[item]], type)) })
- return (pm)
+ pm<-lapply(n, function(item){ return(.entry(item, r[[item]], type)) })
+ return(pm)
}
#' @export
#' @rdname jd3_utilities
.p2r_ts<-function(p){
- if (is.null(p)) return (NULL)
+ if (is.null(p)) return(NULL)
s<-.p2r_tsdata(p$data)
m<-.p2r_moniker(p$moniker)
md<-.p2r_metadata(p$metadata)
- return (.ts(p$name, m, md, s))
+ return(.ts(p$name, m, md, s))
}
#' @export
@@ -105,19 +105,19 @@ dynamic_ts<-function(moniker, data){
p$moniker<-.r2p_moniker(r$moniker)
p$metadata<-.r2p_metadata(r$metadata,jd3.Ts$MetadataEntry)
p$data<- .r2p_tsdata(r$data)
- return (p)
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.p2r_tscollection<-function(p){
if (is.null(p))
- return (NULL)
+ return(NULL)
else{
- rs<-lapply(p$series, function(s){return (.p2r_ts(s))})
- names<-lapply(rs, function(s){return (s$name)})
+ rs<-lapply(p$series, function(s){return(.p2r_ts(s))})
+ names<-lapply(rs, function(s){return(s$name)})
rs<-`names<-`(rs, names)
- return (.tscollection(p$name, .p2r_moniker(p$moniker), .p2r_metadata(p$metadata), rs))
+ return(.tscollection(p$name, .p2r_moniker(p$moniker), .p2r_metadata(p$metadata), rs))
}
}
@@ -128,77 +128,77 @@ dynamic_ts<-function(moniker, data){
p$name<-r$name
p$moniker<-.r2p_moniker(r$moniker)
p$metadata<-.r2p_metadata(r$metadata,jd3.TsCollection$MetadataEntry)
- p$series<- lapply(r$series, function(s){return (.r2p_ts(s))})
- return (p)
+ p$series<- lapply(r$series, function(s){return(.r2p_ts(s))})
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.r2jd_ts<-function(s){
if (is.null(s))
- return (.jnull("jdplus/toolkit/base/api/timeseries/Ts"))
+ return(.jnull("jdplus/toolkit/base/api/timeseries/Ts"))
ps<-.r2p_ts(s)
bytes<-RProtoBuf::serialize(ps, NULL)
- return (.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/Ts;", "tsOfBytes", bytes))
+ return(.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/Ts;", "tsOfBytes", bytes))
}
#' @export
#' @rdname jd3_utilities
.jd2r_ts<-function(js){
if (is.jnull(js))
- return (NULL)
+ return(NULL)
q<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "[B", "toBuffer", js)
p<-RProtoBuf::read(jd3.Ts, q)
- return (.p2r_ts(p))
+ return(.p2r_ts(p))
}
#' @export
#' @rdname jd3_utilities
.r2jd_tscollection<-function(s){
if (is.null(s))
- return (.jnull("jdplus/toolkit/base/api/timeseries/TsCollection"))
+ return(.jnull("jdplus/toolkit/base/api/timeseries/TsCollection"))
ps<-.r2p_tscollection(s)
bytes<-RProtoBuf::serialize(ps, NULL)
- return (.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/Ts;", "tsCollectionOfBytes", bytes))
+ return(.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/Ts;", "tsCollectionOfBytes", bytes))
}
#' @export
#' @rdname jd3_utilities
.jd2r_tscollection<-function(js){
if (is.jnull(js))
- return (NULL)
+ return(NULL)
q<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "[B", "toBuffer", js)
p<-RProtoBuf::read(jd3.TsCollection, q)
- return (.p2r_tscollection(p))
+ return(.p2r_tscollection(p))
}
.r2p_dynamic_ts<-function(r){
p<-jd3.DynamicTsData$new()
p$current<- .r2p_tsdata(r$data)
p$moniker<-.r2p_moniker(r$moniker)
- return (p)
+ return(p)
}
.p2r_dynamic_ts<-function(p){
- if (is.null(p)) return (NULL)
+ if (is.null(p)) return(NULL)
s<-.p2r_tsdata(p$current)
m<-.p2r_moniker(p$moniker)
- return (dynamic_ts(m, s))
+ return(dynamic_ts(m, s))
}
.r2p_dynamic_ts<-function(r){
p<-jd3.DynamicTsData$new()
p$current<- .r2p_tsdata(r$data)
p$moniker<-.r2p_moniker(r$moniker)
- return (p)
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.p2r_datasupplier<-function(p){
- if (p$has('dynamic_data')) return (.p2r_dynamic_ts(p$dynamic_data))
- if (p$has('data')) return (.p2r_tsdata(p$data))
- return (NULL)
+ if (p$has('dynamic_data')) return(.p2r_dynamic_ts(p$dynamic_data))
+ if (p$has('data')) return(.p2r_tsdata(p$data))
+ return(NULL)
}
#' @export
@@ -212,18 +212,18 @@ dynamic_ts<-function(moniker, data){
all<-lapply(1:n, function(z){.r2p_datasupplier(ns[z], r[[z]])})
p<-jd3.TsDataSuppliers$new()
p$items<-all
- return (p)
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.p2r_datasuppliers<-function(p){
n<-length(p$items)
- if (n == 0){return (list())}
+ if (n == 0){return(list())}
l<-lapply(1:n, function(i){return(.p2r_datasupplier(p$items[[i]]))})
ns<-sapply(1:n, function(i){return(p$items[[i]]$name)})
names(l)<-ns
- return (l)
+ return(l)
}
#' @export
@@ -233,7 +233,7 @@ dynamic_ts<-function(moniker, data){
jcal <- .jcall("jdplus/toolkit/base/r/util/Modelling", "Ljdplus/toolkit/base/api/timeseries/regression/TsDataSuppliers;",
"variablesOf",
bytes)
- return (jcal)
+ return(jcal)
}
#' @export
@@ -241,7 +241,7 @@ dynamic_ts<-function(moniker, data){
.jd2p_variables<-function(jd){
bytes<-.jcall("jdplus/toolkit/base/r/util/Modelling", "[B", "toBuffer", jd)
p<-RProtoBuf::read(jd3.TsDataSuppliers, bytes)
- return (p)
+ return(p)
}
@@ -250,14 +250,14 @@ dynamic_ts<-function(moniker, data){
#' @rdname jd3_utilities
.jd2r_variables<-function(jcals){
p<-.jd2p_variables(jcals)
- return (.p2r_datasuppliers(p))
+ return(.p2r_datasuppliers(p))
}
#' @export
#' @rdname jd3_utilities
.r2jd_variables<-function(r){
p<-.r2p_datasuppliers(r)
- return (.p2jd_variables(p))
+ return(.p2jd_variables(p))
}
@@ -326,7 +326,7 @@ modelling_context<-function(calendars=NULL, variables=NULL){
}
}
- return (list(calendars=calendars, variables=variables))
+ return(list(calendars=calendars, variables=variables))
}
@@ -346,7 +346,7 @@ modelling_context<-function(calendars=NULL, variables=NULL){
ns<-sapply(1:n, function(i){return(p$variables[[i]]$key)})
names(lvar)<-ns
}
- return (list(calendars=lcal, variables=lvar))
+ return(list(calendars=lcal, variables=lvar))
}
#' @export
@@ -383,7 +383,7 @@ modelling_context<-function(calendars=NULL, variables=NULL){
p$variables=lvar
}
}
- return (p)
+ return(p)
}
#' @export
@@ -393,7 +393,7 @@ modelling_context<-function(calendars=NULL, variables=NULL){
jcal <- .jcall("jdplus/toolkit/base/r/util/Modelling", "Ljdplus/toolkit/base/api/timeseries/regression/ModellingContext;",
"of",
bytes)
- return (jcal)
+ return(jcal)
}
#' @export
@@ -401,7 +401,7 @@ modelling_context<-function(calendars=NULL, variables=NULL){
.jd2p_context<-function(jd){
bytes<-.jcall("jdplus/toolkit/base/r/util/Modelling", "[B", "toBuffer", jd)
p<-RProtoBuf::read(jd3.ModellingContext, bytes)
- return (p)
+ return(p)
}
@@ -409,14 +409,14 @@ modelling_context<-function(calendars=NULL, variables=NULL){
#' @rdname jd3_utilities
.jd2r_modellingcontext<-function(jcontext){
p<-.jd2p_context(jcontext)
- return (.p2r_context(p))
+ return(.p2r_context(p))
}
#' @export
#' @rdname jd3_utilities
.r2jd_modellingcontext<-function(r){
p<-.r2p_context(r)
- return (.p2jd_context(p))
+ return(.p2jd_context(p))
}
#' @export
@@ -429,7 +429,7 @@ modelling_context<-function(calendars=NULL, variables=NULL){
ns<-sapply(1:n, function(i){return(p$calendars[[i]]$key)})
names(lcal)<-ns
}
- return (lcal)
+ return(lcal)
}
#' @export
@@ -447,7 +447,7 @@ modelling_context<-function(calendars=NULL, variables=NULL){
entry$value<-.r2p_calendardef(r[[i]])
return(entry)
})
- return (p)
+ return(p)
}
#' @export
@@ -457,7 +457,7 @@ modelling_context<-function(calendars=NULL, variables=NULL){
jcal <- .jcall("jdplus/toolkit/base/r/util/Modelling", "Ljdplus/toolkit/base/api/timeseries/calendars/CalendarManager;",
"calendarsOf",
bytes)
- return (jcal)
+ return(jcal)
}
#' @export
@@ -465,7 +465,7 @@ modelling_context<-function(calendars=NULL, variables=NULL){
.jd2p_calendars<-function(jd){
bytes<-.jcall("jdplus/toolkit/base/r/util/Modelling", "[B", "toBuffer", jd)
p<-RProtoBuf::read(jd3.Calendars, bytes)
- return (p)
+ return(p)
}
@@ -473,13 +473,12 @@ modelling_context<-function(calendars=NULL, variables=NULL){
#' @rdname jd3_utilities
.jd2r_calendars<-function(jcals){
p<-.jd2p_calendars(jcals)
- return (.p2r_calendars(p))
+ return(.p2r_calendars(p))
}
#' @export
#' @rdname jd3_utilities
.r2jd_calendars<-function(r){
p<-.r2p_calendars(r)
- return (.p2jd_calendars(p))
+ return(.p2jd_calendars(p))
}
-
diff --git a/R/procresults.R b/R/procresults.R
index 276cb135..d260d770 100644
--- a/R/procresults.R
+++ b/R/procresults.R
@@ -11,7 +11,7 @@ RSLT<-'JD3_ProcResults'
classes<-c(OBJ, RSLT, subclasses)
else
classes<-c(OBJ, subclasses)
- return (structure(list(internal=jobjRef), class=classes))
+ return(structure(list(internal=jobjRef), class=classes))
}
diff --git a/R/protobuf.R b/R/protobuf.R
index 03e62ef0..dedbed34 100644
--- a/R/protobuf.R
+++ b/R/protobuf.R
@@ -16,26 +16,26 @@ NULL
#' @export
#' @rdname jd3_utilities
.enum_sextract<-function(type, p){
- return (type$value(number=p)$name())
+ return(type$value(number=p)$name())
}
#' @export
#' @rdname jd3_utilities
.enum_sof<-function(type, code){
- return (type$value(name=code)$number())
+ return(type$value(name=code)$number())
}
#' @export
#' @rdname jd3_utilities
.enum_extract<-function(type, p){
name<-type$value(number=p)$name()
- return (substring(name, regexpr("_", name)+1))
+ return(substring(name, regexpr("_", name)+1))
}
#' @export
#' @rdname jd3_utilities
.enum_of<-function(type, code, prefix){
i<-type$value(name=paste(prefix, code, sep='_'))$number()
- return (i)
+ return(i)
}
#' @export
@@ -49,34 +49,34 @@ NULL
p$value<-r$value
p$type<-.enum_of(jd3.ParameterType, r$type, "PARAMETER")
}
- return (p)
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.p2r_parameter<-function(p){
- if (! p$has("type")) return (NULL)
- return (list(value = p$value, type=.enum_extract(jd3.ParameterType, p$type)))
+ if (! p$has("type")) return(NULL)
+ return(list(value = p$value, type=.enum_extract(jd3.ParameterType, p$type)))
}
#' @export
#' @rdname jd3_utilities
.r2p_parameters<-function(r){
n<-length(r)
- if (n == 0) return (NULL)
+ if (n == 0) return(NULL)
p<-apply(r, 2, function(z){.r2p_parameter(z)})
- return (p)
+ return(p)
}
# .r2p_parameters<-function(data, type){
# # r is a numeric vector, type identifies the type of the parameter ('FIXED'...)
# n<-length(data)
-# if (n == 0) return (NULL)
+# if (n == 0) return(NULL)
# ptype<-.enum_of(jd3.ParameterType, type, "PARAMETER")
#
# p<-lapply(data, function(z){.r2p_parameter(z, ptype)})
-# return (p)
+# return(p)
# }
#' @export
@@ -84,9 +84,9 @@ NULL
.r2p_lparameters<-function(r){
# r is a list of lists with value/type entries
n<-length(r)
- if (n == 0) return (NULL)
+ if (n == 0) return(NULL)
p<-lapply(r, function(z){.r2p_parameter(z)})
- return (p)
+ return(p)
}
@@ -95,28 +95,28 @@ NULL
#' @rdname jd3_utilities
.p2r_parameters<-function(p){
n<-length(p)
- if (n == 0) return (NULL)
+ if (n == 0) return(NULL)
r<-sapply(p, function(z){list(value=z$value, type=.enum_extract(jd3.ParameterType, z$type))})
- return (r)
+ return(r)
}
#' @export
#' @rdname jd3_utilities
.p2r_parameters_rslt<-function(p){
if (is.null(p))
- return (NULL)
+ return(NULL)
if (length(p) == 0)
- return (NULL)
+ return(NULL)
value<-sapply(p, function(z){z$value})
type<-sapply(p, function(z){.enum_extract(jd3.ParameterType, z$type)})
- return (data.frame(value=value, type=type))
+ return(data.frame(value=value, type=type))
}
#' @export
#' @rdname jd3_utilities
.p2r_parameters_rsltx<-function(p){
if (is.null(p))
- return (NULL)
+ return(NULL)
if (length(p) == 0)
- return (NULL)
+ return(NULL)
value<-sapply(p, function(z){z$value})
type<-sapply(p, function(z){.enum_extract(jd3.ParameterType, z$type)})
description<-sapply(p, function(z){z$description})
@@ -124,7 +124,7 @@ NULL
rslt<-data.frame(value=value, type=type)
row.names(rslt)<-description
- return (rslt)
+ return(rslt)
}
#' @export
#' @rdname jd3_utilities
@@ -132,7 +132,7 @@ NULL
if (is.null(p))
return(NULL)
p = p$as.list()
- return (statisticaltest(p$value, p$pvalue, p$description))
+ return(statisticaltest(p$value, p$pvalue, p$description))
}
#' @export
@@ -140,7 +140,7 @@ NULL
.p2r_matrix<-function(p){
m<-matrix(data=p$values, nrow = p$nrows, ncol = p$ncols)
`attr<-`(m, "name", p$name)
- return (m)
+ return(m)
}
.r2p_matrix<-function(r){
@@ -149,17 +149,17 @@ NULL
p$nrows<-nrow(r)
p$ncols<-ncol(r)
p$values<-as.numeric(r)
- return (p)
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.p2r_tsdata<-function(p){
if (length(p$values) == 0)
- return (NULL)
+ return(NULL)
s<-ts(data=p$values, frequency = p$annual_frequency, start = c(p$start_year, p$start_period))
s<-`attr<-`(s, "name", p$name)
- return (s)
+ return(s)
}
#' @export
@@ -172,22 +172,22 @@ NULL
p$start_year=s[1]
p$start_period=s[2]
p$values<-as.numeric(r)
- return (p)
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.p2r_parameters_estimation<-function(p){
if (is.null(p))
- return (NULL)
- return (list(val=p$value, score=p$score, cov=.p2r_matrix(p$covariance), description=p$description))
+ return(NULL)
+ return(list(val=p$value, score=p$score, cov=.p2r_matrix(p$covariance), description=p$description))
}
#' @export
#' @rdname jd3_utilities
.p2r_likelihood<-function(p){
- return (likelihood(p$nobs, p$neffectiveobs, p$nparams,
+ return(likelihood(p$nobs, p$neffectiveobs, p$nparams,
p$log_likelihood, p$adjusted_log_likelihood,
p$aic, p$aicc, p$bic, p$bicc, p$ssq))
}
@@ -196,9 +196,9 @@ NULL
#' @rdname jd3_utilities
.p2r_date<-function(p){
if (p$has('year')){
- return (ymd(p$year, p$month, p$day))
+ return(ymd(p$year, p$month, p$day))
} else{
- return (NULL)
+ return(NULL)
}
}
@@ -206,7 +206,7 @@ NULL
#' @rdname jd3_utilities
.r2p_date<-function(s){
if (is.null(s)) return(jd3.Date$new())
- else return (parseDate(s))
+ else return(parseDate(s))
}
@@ -218,7 +218,7 @@ NULL
dt0<-.p2r_date(span$d0)
dt1<-.p2r_date(span$d1)
- return (structure(list(type=type, d0=dt0, d1=dt1, n0=span$n0, n1=span$n1), class= "JD3_SPAN"))
+ return(structure(list(type=type, d0=dt0, d1=dt1, n0=span$n0, n1=span$n1), class= "JD3_SPAN"))
}
#' @export
#' @rdname jd3_utilities
@@ -229,25 +229,25 @@ NULL
pspan$n1<-rspan$n1
pspan$d0<-.r2p_date(rspan$d0)
pspan$d1<-.r2p_date(rspan$d1)
- return (pspan)
+ return(pspan)
}
.p2r_sarima<-function(p){
- return (sarima_model(p$name, p$period, p$phi, p$d, p$theta,
+ return(sarima_model(p$name, p$period, p$phi, p$d, p$theta,
p$bphi, p$bd, p$btheta))
}
#' @export
#' @rdname jd3_utilities
.p2r_arima<-function(p){
- return (arima_model(p$name, p$ar, p$delta, p$ma, p$innovation_variance))
+ return(arima_model(p$name, p$ar, p$delta, p$ma, p$innovation_variance))
}
#' @export
#' @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)}), FALSE))
+ return(ucarima_model(model,lapply(p$components, function(z){.p2r_arima(z)}), lapply(p$complements, function(z){.p2r_arima(z)}), FALSE))
}
@@ -256,7 +256,7 @@ NULL
#' @export
#' @rdname jd3_utilities
.p2r_spec_sarima<-function(spec){
- return (structure(
+ return(structure(
list(
period=spec$period,
d=spec$d,
@@ -280,12 +280,12 @@ NULL
p$theta<-.r2p_parameters(r$theta)
p$bphi<-.r2p_parameters(r$bphi)
p$btheta<-.r2p_parameters(r$btheta)
- return (p)
+ return(p)
}
.p2r_outlier<-function(p){
- return (list(
+ return(list(
name=p$name,
pos=.p2r_date(p$position),
code=p$code,
@@ -299,25 +299,25 @@ NULL
p$code<-r$code
p$position<-.r2p_date(r$pos)
p$coefficient<-.r2p_parameter(r$coef)
- return (p)
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.p2r_outliers<-function(p){
- if (length(p) == 0){return (NULL)}
- return (lapply(p, function(z){.p2r_outlier(z)}))
+ if (length(p) == 0){return(NULL)}
+ return(lapply(p, function(z){.p2r_outlier(z)}))
}
#' @export
#' @rdname jd3_utilities
.r2p_outliers<-function(r){
- if (length(r) == 0){return (list())}
- return (lapply(r, function(z){.r2p_outlier(z)}))
+ if (length(r) == 0){return(list())}
+ return(lapply(r, function(z){.r2p_outlier(z)}))
}
.p2r_sequence<-function(p){
- return (list(
+ return(list(
start=.p2r_date(p$start),
end=.p2r_date(p$end)
))
@@ -327,27 +327,27 @@ NULL
p<-modelling.InterventionVariable$Sequence$new()
p$start<-.r2p_date(r$start)
p$end<-.r2p_date(r$end)
- return (p)
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.p2r_sequences<-function(p){
- if (length(p) == 0){return (NULL)}
- return (lapply(p, function(z){.p2r_sequence(z)}))
+ if (length(p) == 0){return(NULL)}
+ return(lapply(p, function(z){.p2r_sequence(z)}))
}
#' @export
#' @rdname jd3_utilities
.r2p_sequences<-function(r){
- if (length(r) == 0){return (list())}
- return (lapply(r, function(z){.r2p_sequence(z)}))
+ if (length(r) == 0){return(list())}
+ return(lapply(r, function(z){.r2p_sequence(z)}))
}
#' @export
#' @rdname jd3_utilities
.p2r_iv<-function(p){
- return (list(
+ return(list(
name=p$name,
sequences=.p2r_sequences(p$sequences),
delta=p$delta,
@@ -365,28 +365,28 @@ NULL
p$sequences<-.r2p_sequences(r$sequences)
p$coefficient<-.r2p_parameter(r$coef)
p$metadata<-modelling.InterventionVariable.MetadataEntry$new(key = "regeffect", value=r$regeffect)
- return (p)
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.p2r_ivs<-function(p){
- if (length(p) == 0){return (NULL)}
- return (lapply(p, function(z){.p2r_iv(z)}))
+ if (length(p) == 0){return(NULL)}
+ return(lapply(p, function(z){.p2r_iv(z)}))
}
#' @export
#' @rdname jd3_utilities
.r2p_ivs<-function(r){
- if (length(r) == 0){return (list())}
- return (lapply(r, function(z){.r2p_iv(z)}))
+ if (length(r) == 0){return(list())}
+ return(lapply(r, function(z){.r2p_iv(z)}))
}
.p2r_ramp<-function(p){
- return (list(
+ return(list(
name=p$name,
start=.p2r_date(p$start),
end=.p2r_date(p$end),
@@ -401,34 +401,34 @@ NULL
p$start<-.r2p_date(r$start)
p$end<-.r2p_date(r$end)
p$coefficient<-.r2p_parameter(r$coef)
- return (p)
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.p2r_ramps<-function(p){
- if (length(p) == 0){return (NULL)}
- return (lapply(p, function(z){.p2r_ramp(z)}))
+ if (length(p) == 0){return(NULL)}
+ return(lapply(p, function(z){.p2r_ramp(z)}))
}
#' @export
#' @rdname jd3_utilities
.r2p_ramps<-function(r){
- if (length(r) == 0){return (list())}
- return (lapply(r, function(z){.r2p_ramp(z)}))
+ if (length(r) == 0){return(list())}
+ return(lapply(r, function(z){.r2p_ramp(z)}))
}
.regeffect<-function(map){
if (length(map) == 0)
return("Undefined")
r<-which(sapply(map, function(z){z$key == "regeffect"}))
- if (length(r) == 0) return ("Undefined")
- return (map[[min(r)]]$value)
+ if (length(r) == 0) return("Undefined")
+ return(map[[min(r)]]$value)
}
.p2r_uservar<-function(p){
l<-p$lag
- return (list(
+ return(list(
id=p$id,
name=p$name,
lag=l,
@@ -444,38 +444,38 @@ NULL
p$lag<-r$lag
p$coefficient<-.r2p_parameter(r$coef)
p$metadata<-modelling.TsVariable.MetadataEntry$new(key = "regeffect", value=r$regeffect)
- return (p)
+ return(p)
}
#' @export
#' @rdname jd3_utilities
.p2r_uservars<-function(p){
- if (length(p) == 0){return (NULL)}
- return (lapply(p, function(z){.p2r_uservar(z)}))
+ if (length(p) == 0){return(NULL)}
+ return(lapply(p, function(z){.p2r_uservar(z)}))
}
#' @export
#' @rdname jd3_utilities
.r2p_uservars<-function(r){
- if (length(r) == 0){return (list())}
- return (lapply(r, function(z){.r2p_uservar(z)}))
+ if (length(r) == 0){return(list())}
+ return(lapply(r, function(z){.r2p_uservar(z)}))
}
#' @export
#' @rdname jd3_utilities
.p2r_variables<-function(p){
- return (lapply(p, function(v){.p2r_variable(v)}))
+ return(lapply(p, function(v){.p2r_variable(v)}))
}
.p2r_variable<-function(p){
name<-p$name
type<-.enum_extract(modelling.VariableType, p$var_type)
coef<-.p2r_parameters_rsltx(p$coefficients)
- return (list(name=name, type=type, coef=coef))
+ return(list(name=name, type=type, coef=coef))
}
.p2r_component<-function(p){
s<-p$data$values
n<-length(s)
- if (n == 0) return (NULL)
+ if (n == 0) return(NULL)
freq<-p$data$annual_frequency
start<-c(p$data$start_year, p$data$start_period)
nb<-p$nbcasts
@@ -491,16 +491,16 @@ NULL
fcasts<-ts(s[(n-nf+1):n], frequency = freq, start=.ts_move(start, freq, n-nf))
rslt[['fcasts']]<-fcasts
}
- return (rslt)
+ return(rslt)
}
.p2r_sa_component<-function(p){
e<-p$stde
- if (length(e) == 0) return (.p2r_component(p))
+ if (length(e) == 0) return(.p2r_component(p))
s<-p$data$values
n<-length(s)
- if (n == 0) return (NULL)
+ if (n == 0) return(NULL)
freq<-p$data$annual_frequency
start<-c(p$data$start_year, p$data$start_period)
nb<-p$nbcasts
@@ -528,14 +528,14 @@ NULL
rslt[['fcasts.stde']]<-efcasts
}
- return (rslt)
+ return(rslt)
}
#' @export
#' @rdname jd3_utilities
.p2r_sa_decomposition<-function(p, full=FALSE){
if (full){
- return (list(mode = .enum_extract(sa.DecompositionMode, p$mode),
+ return(list(mode = .enum_extract(sa.DecompositionMode, p$mode),
series=.p2r_sa_component(p$series),
sa=.p2r_sa_component(p$seasonally_adjusted),
t=.p2r_sa_component(p$trend),
@@ -543,7 +543,7 @@ NULL
i=.p2r_sa_component(p$irregular)
))
} else{
- return (list(mode = .enum_extract(sa.DecompositionMode, p$mode),
+ return(list(mode = .enum_extract(sa.DecompositionMode, p$mode),
series=.p2r_component(p$series),
sa=.p2r_component(p$seasonally_adjusted),
t=.p2r_component(p$trend),
@@ -556,7 +556,7 @@ NULL
#' @export
#' @rdname jd3_utilities
.p2r_sa_diagnostics<-function(p){
- return (list(vardecomposition =p$variance_decomposition$as.list(),
+ return(list(vardecomposition =p$variance_decomposition$as.list(),
seas.ftest.i=.p2r_test(p$seasonal_ftest_on_irregular),
seas.ftest.sa=.p2r_test(p$seasonal_ftest_on_sa),
seas.qstest.i=.p2r_test(p$seasonal_qtest_on_irregular),
@@ -569,17 +569,17 @@ NULL
.ts_move<-function(period, freq, delta){
- if (delta == 0)return (period)
- if (freq == 1)return (c(period[1]+delta, 1))
+ if (delta == 0)return(period)
+ if (freq == 1)return(c(period[1]+delta, 1))
x<-period[1]*freq+(period[2]+delta-1)
- return (c(x %/% freq, (x %% freq)+1))
+ return(c(x %/% freq, (x %% freq)+1))
}
# Benchmarking
#' @export
#' @rdname jd3_utilities
.p2r_spec_benchmarking<-function(p){
- return (list(
+ return(list(
enabled=p$enabled,
target=.enum_extract(sa.BenchmarkingTarget, p$target),
lambda=p$lambda,
@@ -598,5 +598,5 @@ NULL
p$rho<-r$rho
p$bias<-.enum_of(sa.BenchmarkingBias, r$bias, "BENCH")
p$forecast<-r$forecast
- return (p)
+ return(p)
}
diff --git a/R/regarima_rslts.R b/R/regarima_rslts.R
index 68954a79..2296a889 100644
--- a/R/regarima_rslts.R
+++ b/R/regarima_rslts.R
@@ -4,7 +4,7 @@ NULL
#' @export
#' @rdname jd3_utilities
.p2r_regarima_rslts<-function(p){
- return (structure(list(
+ return(structure(list(
description=.p2r_regarima_description(p$description),
estimation=.p2r_regarima_estimation(p$estimation),
diagnostics=.p2r_regarima_diagnostics(p$diagnostics)),
@@ -13,7 +13,7 @@ NULL
}
.p2r_regarima_description<-function(p){
- return (list(
+ return(list(
log=p$log,
preadjustment = .enum_extract(modelling.LengthOfPeriod, p$preadjustment),
arima=.p2r_spec_sarima(p$arima),
@@ -22,7 +22,7 @@ NULL
}
.p2r_regarima_estimation<-function(p){
- return (list(
+ return(list(
y=p$y,
X=.p2r_matrix(p$x),
parameters=.p2r_parameters_estimation(p$parameters),
@@ -38,5 +38,5 @@ NULL
tlist<-lapply(p$residuals_tests, function(z){.p2r_test(z$value)})
tnames<-lapply(p$residuals_tests, function(z){z$key})
testonresiduals<-`names<-`(tlist, tnames)
- return (testonresiduals)
+ return(testonresiduals)
}
diff --git a/R/spec_regarima.R b/R/spec_regarima.R
index 14acfbf7..ddacd9f4 100644
--- a/R/spec_regarima.R
+++ b/R/spec_regarima.R
@@ -508,7 +508,7 @@ set_outlier.default <- function(x,
choices = c("ADDONE", "ADDALL"))
outlier$method <- method
}
- if (!is.na(maxiter) ) {
+ if (!is.na(maxiter)) {
outlier$maxiter <- maxiter
}
if (!is.na(lsrun)) {
diff --git a/R/splines.R b/R/splines.R
index 19b8d841..66979482 100644
--- a/R/splines.R
+++ b/R/splines.R
@@ -14,6 +14,6 @@ periodic_splines<-function(order=4, period=1, knots, pos){
jm<-.jcall("jdplus/toolkit/base/r/math/BSplines", "Ljdplus/toolkit/base/core//math/matrices/Matrix;",
"periodic", as.integer(order), as.numeric(period), .jarray(as.numeric(knots)), .jarray(as.numeric(pos)))
res <- .jd2r_matrix(jm)
- return (res)
+ return(res)
}
diff --git a/R/tests_regular.R b/R/tests_regular.R
index f2f21d6f..89ae773d 100644
--- a/R/tests_regular.R
+++ b/R/tests_regular.R
@@ -29,7 +29,7 @@ statisticaltest<-function(val, pval, dist=NULL){
} else if (pval>1){
pval=1
}
- return (structure(list(value=val, pvalue=pval), distribution=dist, class=c("JD3_TEST", "JD3")))
+ return(structure(list(value=val, pvalue=pval), distribution=dist, class=c("JD3_TEST", "JD3")))
}
#' @rdname statisticaltest
@@ -70,7 +70,7 @@ print.JD3_TEST<-function(x, details=FALSE, ...){
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))
+ return(.jd2r_test(jtest))
}
#' Normality Tests
@@ -100,14 +100,14 @@ NULL
#' @describeIn normality_tests Bowman-Shenton test
bowmanshenton<-function(data){
jtest<-.jcall("jdplus/toolkit/base/r/stats/Tests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "bowmanShenton",as.numeric(data))
- return (.jd2r_test(jtest))
+ return(.jd2r_test(jtest))
}
#' @export
#' @describeIn normality_tests Doornik-Hansen test
doornikhansen<-function(data){
jtest<-.jcall("jdplus/toolkit/base/r/stats/Tests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "doornikHansen",as.numeric(data))
- return (.jd2r_test(jtest))
+ return(.jd2r_test(jtest))
}
#' @export
@@ -115,7 +115,7 @@ doornikhansen<-function(data){
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))
+ return(.jd2r_test(jtest))
}
#' Runs Tests around the mean or the median
@@ -144,7 +144,7 @@ NULL
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))
+ return(.jd2r_test(jtest))
}
#' @describeIn runstests up and down runs test
@@ -152,7 +152,7 @@ testofruns<-function(data, mean=TRUE, number=TRUE){
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))
+ return(.jd2r_test(jtest))
}
#' Autocorrelation Functions
@@ -171,7 +171,7 @@ 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)
- return (res)
+ return(res)
}
#' @export
#' @rdname autocorrelations
@@ -179,7 +179,7 @@ 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)
- return (res)
+ return(res)
}
#' @export
#' @rdname autocorrelations
@@ -187,21 +187,21 @@ autocorrelations_inverse<-function(data, nar=30, n=15){
res <- .jcall("jdplus/toolkit/base/r/stats/Tests", "[D", "inverseAutocorrelations",
as.numeric(data), as.integer(nar), as.integer(n))
names(res) <- seq_len(n)
- return (res)
+ return(res)
}
#' @export
#' @describeIn normality_tests Skewness test
skewness<-function(data){
jtest<-.jcall("jdplus/toolkit/base/r/stats/Tests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "skewness",as.numeric(data))
- return (.jd2r_test(jtest))
+ return(.jd2r_test(jtest))
}
#' @export
#' @describeIn normality_tests Kurtosis test
kurtosis<-function(data){
jtest<-.jcall("jdplus/toolkit/base/r/stats/Tests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "kurtosis",as.numeric(data))
- return (.jd2r_test(jtest))
+ return(.jd2r_test(jtest))
}
#' Title
@@ -215,5 +215,5 @@ kurtosis<-function(data){
#'
#' @examples
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)))
+ 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 dfa08b91..61cca5b4 100644
--- a/R/tests_seasonality.R
+++ b/R/tests_seasonality.R
@@ -23,7 +23,7 @@ seasonality_qs<-function(data, period, nyears=0){
period <- frequency(data)
jtest<-.jcall("jdplus/sa/base/r/SeasonalityTests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "qsTest",
as.numeric(data), as.integer(period), as.integer(nyears))
- return (.jd2r_test(jtest))
+ return(.jd2r_test(jtest))
}
#' Kruskall-Wallis Seasonality Test
@@ -43,7 +43,7 @@ seasonality_kruskalwallis<-function(data, period, nyears=0){
period <- frequency(data)
jtest<-.jcall("jdplus/sa/base/r/SeasonalityTests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "kruskalWallisTest",
as.numeric(data), as.integer(period), as.integer(nyears))
- return (.jd2r_test(jtest))
+ return(.jd2r_test(jtest))
}
#' Periodogram Seasonality Test
@@ -62,7 +62,7 @@ seasonality_periodogram<-function(data, period, nyears=0){
period <- frequency(data)
jtest<-.jcall("jdplus/sa/base/r/SeasonalityTests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "periodogramTest",
as.numeric(data), as.integer(period), as.integer(nyears))
- return (.jd2r_test(jtest))
+ return(.jd2r_test(jtest))
}
#' Friedman Seasonality Test
@@ -79,7 +79,7 @@ seasonality_friedman<-function(data, period, nyears=0){
period <- frequency(data)
jtest<-.jcall("jdplus/sa/base/r/SeasonalityTests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "friedmanTest",
as.numeric(data), as.integer(period), as.integer(nyears))
- return (.jd2r_test(jtest))
+ return(.jd2r_test(jtest))
}
#' F-test on seasonal dummies
@@ -102,7 +102,7 @@ seasonality_f<-function(data,
model<-match.arg(model)
jtest<-.jcall("jdplus/sa/base/r/SeasonalityTests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "fTest",
as.numeric(data), as.integer(period), model, as.integer(nyears))
- return (.jd2r_test(jtest))
+ return(.jd2r_test(jtest))
}
@@ -126,7 +126,7 @@ seasonality_combined<-function(data, period, firstperiod=cycle(data)[1], mul=TRU
as.numeric(data), as.integer(period), as.integer(firstperiod-1), as.logical(mul))
q<-.jcall("jdplus/sa/base/r/SeasonalityTests", "[B", "toBuffer", jctest)
p<-RProtoBuf::read(sa.CombinedSeasonalityTest, q)
- return (list(
+ return(list(
seasonality=.enum_extract(sa.IdentifiableSeasonality, p$seasonality),
kruskalwallis=.p2r_test(p$kruskal_wallis),
stable=.p2r_anova(p$stable_seasonality),
@@ -147,5 +147,5 @@ seasonality_combined<-function(data, period, firstperiod=cycle(data)[1], mul=TRU
seasonality_canovahansen<-function(data, p0, p1, np, original=FALSE){
jtest<-.jcall("jdplus/sa/base/r/SeasonalityTests", "[D", "canovaHansenTest",
as.numeric(data), as.numeric(p0), as.numeric(p1), as.integer(np), as.logical(original))
- return (jtest)
+ return(jtest)
}
diff --git a/R/tests_td.R b/R/tests_td.R
index f72939a1..8de9858f 100644
--- a/R/tests_td.R
+++ b/R/tests_td.R
@@ -51,7 +51,7 @@ td_f<-function(s, model=c("D1", "DY", "DYD1", "WN", "AIRLINE", "R011", "R100"),
jts<-.r2jd_tsdata(s)
jtest<-.jcall("jdplus/toolkit/base/r/modelling/TradingDaysTests", "Ljdplus/toolkit/base/api/stats/StatisticalTest;", "fTest",
jts, model, as.integer(nyears))
- return (.jd2r_test(jtest))
+ return(.jd2r_test(jtest))
}
#' Canova-Hansen Trading Days test
@@ -65,6 +65,6 @@ td_f<-function(s, model=c("D1", "DY", "DYD1", "WN", "AIRLINE", "R011", "R100"),
#' @examples
td_ch<-function(s, differencing){
jts<-.r2jd_tsdata(s)
- return (.jcall("jdplus/toolkit/base/r/modelling/TradingDaysTests", "[D", "chTest",
+ return(.jcall("jdplus/toolkit/base/r/modelling/TradingDaysTests", "[D", "chTest",
jts, .jarray(as.integer(differencing))))
}
diff --git a/R/timeseries.R b/R/timeseries.R
index c1a843ef..3640ff11 100644
--- a/R/timeseries.R
+++ b/R/timeseries.R
@@ -34,15 +34,15 @@ aggregate.default<-function(s, nfreq=1,
complete=TRUE){
conversion <- match.arg(conversion)
if (is.null(s)){
- return (NULL)
+ return(NULL)
}
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))
+ return(.jd2r_tsdata(jd_agg))
}
}
#' @export
@@ -79,16 +79,16 @@ aggregate.data.frame <- function(s, nfreq=1,
#' clean_extremities(y)
clean_extremities<-function(s){
if (is.null(s)){
- return (NULL)
+ return(NULL)
}
jd_s<-.r2jd_tsdata(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))
+ return(.jd2r_tsdata(jd_scleaned))
}
}
@@ -110,17 +110,17 @@ ts_interpolate<-function(s, method=c("airline", "average")){
ts_interpolate.default<-function(s, method=c("airline", "average")){
method<-match.arg(method)
if (is.null(s)){
- return (NULL)
+ return(NULL)
}
jd_s<-.r2jd_tsdata(s)
if (method == "airline"){
jd_si<-.jcall("jdplus/toolkit/base/r/modelling/Interpolation", "Ljdplus/toolkit/base/api/timeseries/TsData;", "airlineInterpolation", jd_s)
- return (.jd2r_tsdata(jd_si))
+ return(.jd2r_tsdata(jd_si))
} else if (method == "average"){
jd_si<-.jcall("jdplus/toolkit/base/r/modelling/Interpolation", "Ljdplus/toolkit/base/api/timeseries/TsData;", "averageInterpolation", jd_s)
- return (.jd2r_tsdata(jd_si))
+ return(.jd2r_tsdata(jd_si))
} else
- return (NULL)
+ return(NULL)
}
#' @export
ts_interpolate.matrix <- function(s, method=c("airline", "average")){
@@ -162,15 +162,15 @@ ts_adjust<-function(s, method=c("LeapYear", "LengthOfPeriod"), reverse = FALSE){
ts_adjust.default<-function(s, method=c("LeapYear", "LengthOfPeriod"), reverse = FALSE){
method<-match.arg(method)
if (is.null(s)){
- return (NULL)
+ return(NULL)
}
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))
+ return(.jd2r_tsdata(jd_st))
}
}
#' @export
@@ -203,7 +203,7 @@ daysOf<-function(ts, pos=0){
start<-start(ts)
jdom<-.r2jd_tsdomain(frequency(ts), start[1], start[2], length(ts))
days<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "[S", "daysOf",jdom, as.integer(pos))
- return (as.Date(days))
+ return(as.Date(days))
}
#' Title
@@ -221,7 +221,7 @@ to_ts<-function(source, id, type="All"){
jts<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/Ts;", "makeTs", jmoniker, type)
bytes<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "[B", "toBuffer", jts)
p<-RProtoBuf::read(jd3.Ts, bytes)
- return (.p2r_ts(p))
+ return(.p2r_ts(p))
}
#' Title
@@ -239,7 +239,7 @@ to_tscollection<-function(source, id, type="All"){
jtscoll<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/Ts;", "makeTsCollection", jmoniker, type)
bytes<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "[B", "toBuffer", jtscoll)
p<-RProtoBuf::read(jd3.TsCollection, bytes)
- return (.p2r_tscollection(p))
+ return(.p2r_tscollection(p))
}
#' Promote a R time series to a "full" ts of jdemetra
@@ -257,14 +257,14 @@ data_to_ts<-function(s, name){
jts<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/Ts;", "makeTs", .r2jd_tsdata(s), name)
bytes<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "[B", "toBuffer", jts)
p<-RProtoBuf::read(jd3.Ts, bytes)
- return (.p2r_ts(p))
+ return(.p2r_ts(p))
}
#' @export
#' @rdname jd3_utilities
.r2jd_tmp_ts<-function(s, name){
jts<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/Ts;", "makeTs", .r2jd_tsdata(s), name)
- return (jts)
+ return(jts)
}
#' @export
@@ -272,7 +272,7 @@ data_to_ts<-function(s, name){
.r2jd_make_ts<-function(source, id, type="All"){
jmoniker=.jcall("jdplus/toolkit/base/api/timeseries/TsMoniker", "Ljdplus/toolkit/base/api/timeseries/TsMoniker;", "of", source, id)
jts<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/Ts;", "makeTs", jmoniker, type)
- return (jts)
+ return(jts)
}
#' @export
@@ -280,7 +280,7 @@ data_to_ts<-function(s, name){
.r2jd_make_tscollection<-function(source, id, type="All"){
jmoniker<-.jcall("jdplus/toolkit/base/api/timeseries/TsMoniker", "Ljdplus/toolkit/base/api/timeseries/TsMoniker;", "of", source, id)
jtscoll<-.jcall("jdplus/toolkit/base/r/timeseries/TsUtility", "Ljdplus/toolkit/base/api/timeseries/Ts;", "makeTsCollection", jmoniker, type)
- return (jtscoll)
+ return(jtscoll)
}
#' Title
@@ -302,7 +302,7 @@ tsdata_of<-function(values, dates){
jtsdata<-.jcall("jdplus/toolkit/base/r/timeseries/TsDataCollector", "Ljdplus/toolkit/base/api/timeseries/TsData;",
"of", as.numeric(values), as.character(dates))
- return (.jd2r_tsdata(jtsdata))
+ return(.jd2r_tsdata(jtsdata))
}
#' Compare the annual totals of two series (usually the raw series and the seasonally adjusted series)
@@ -317,5 +317,5 @@ tsdata_of<-function(values, dates){
compare_annual_totals<-function(raw, sa){
jsa<-.r2jd_tsdata(sa)
jraw<-.r2jd_tsdata(raw)
- return (.jcall("jdplus/sa/base/r/SaUtility", "D", "compareAnnualTotals", jraw, jsa))
+ return(.jcall("jdplus/sa/base/r/SaUtility", "D", "compareAnnualTotals", jraw, jsa))
}
diff --git a/R/utils.R b/R/utils.R
index d9ed8d95..f46727f5 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -3,23 +3,23 @@
NULL
ymd<-function(y, m, d=1){
- return (as.Date(sprintf("%04i-%02i-%02i", y, m, d)))
+ return(as.Date(sprintf("%04i-%02i-%02i", y, m, d)))
}
yearOf<-function(s){
- return ( as.integer(substr(s, 1, 4)))
+ return(as.integer(substr(s, 1, 4)))
}
monthOf<-function(s){
- return ( as.integer(substr(s, 6, 7)))
+ return(as.integer(substr(s, 6, 7)))
}
dayOf<-function(s){
- return ( as.integer(substr(s, 9, 10)))
+ return(as.integer(substr(s, 9, 10)))
}
dateOf<-function(year, month, day){
d<-jd3.Date$new()
d$year<-year
d$month<-month
d$day<-day
- return (d)
+ return(d)
}
parseDate<-function(s){
@@ -27,7 +27,7 @@ parseDate<-function(s){
d$year<-yearOf(s)
d$month<-monthOf(s)
d$day<-dayOf(s)
- return (d)
+ return(d)
}
#' Title
@@ -43,14 +43,14 @@ NULL
.p2r_anova<-function(p){
- return (list(SSM=p$SSM, dfM=p$dfm, SSR=p$SSR, dfR=p$dfr, test=test_anova(p$SSM, p$dfm, p$SSR, p$dfr)))
+ return(list(SSM=p$SSM, dfM=p$dfm, SSR=p$SSR, dfR=p$dfr, test=test_anova(p$SSM, p$dfm, p$SSR, p$dfr)))
}
test_anova<-function(ssm, dfm, ssr, dfr){
val<-(ssm/dfm)*(dfr/ssr)
desc<-paste0("F(",dfm,",",dfr,")")
pval<-1-pf(val, dfm, dfr)
- return (statisticaltest(val, pval, desc))
+ return(statisticaltest(val, pval, desc))
}
#' Title
@@ -75,7 +75,7 @@ likelihood<-function(nobs, neffectiveobs=NA, nparams=0, ll, adjustedll=NA, aic,
if (is.na(neffectiveobs)) neffectiveobs<-obs
if (is.na(adjustedll)) adjustedll<-ll
- return (structure(list(nobs=nobs, neffectiveobs=neffectiveobs, nparams=nparams,
+ return(structure(list(nobs=nobs, neffectiveobs=neffectiveobs, nparams=nparams,
ll=ll, adjustedll=adjustedll,
aic=aic, aicc=aicc, bic=bic, bicc=bicc, ssq=ssq),
class = "JD3_LIKELIHOOD"))
diff --git a/R/variables.R b/R/variables.R
index e86b1925..66c9d923 100644
--- a/R/variables.R
+++ b/R/variables.R
@@ -29,7 +29,7 @@ easter_variable<-function(frequency, start, length, s, duration=6, endpos=-1,
}
jdom<-.r2jd_tsdomain(frequency, start[1], start[2], length)
data<-.jcall("jdplus/toolkit/base/r/modelling/Variables", "[D", "easter", jdom, as.integer(duration), as.integer(endpos), correction)
- return (ts(data, frequency = frequency, start= start))
+ return(ts(data, frequency = frequency, start= start))
}
#' @rdname easter_variable
@@ -42,7 +42,7 @@ julianeaster_variable<-function(frequency, start, length, s, duration=6){
}
jdom<-.r2jd_tsdomain(frequency, start[1], start[2], length)
data<-.jcall("jdplus/toolkit/base/r/modelling/Variables", "[D", "julianEaster", jdom, as.integer(duration))
- return (ts(data, frequency = frequency, start= start))
+ return(ts(data, frequency = frequency, start= start))
}
#' Leap Year regressor
@@ -73,7 +73,7 @@ lp_variable<-function(frequency, start, length, s, type=c("LeapYear", "LengthOfP
}
jdom<-.r2jd_tsdomain(frequency, start[1], start[2], length)
data<-.jcall("jdplus/toolkit/base/r/modelling/Variables", "[D", "leapYear", jdom, as.logical(lp))
- return (ts(data, frequency = frequency, start= start))
+ return(ts(data, frequency = frequency, start= start))
}
#' Generating Outlier regressors
@@ -124,7 +124,7 @@ ao_variable<-function(frequency, start, length, s, pos, date=NULL){
} else{
data<-.jcall("jdplus/toolkit/base/r/modelling/Variables", "[D", "ao", jdom, as.character(date))
}
- return (ts(data, frequency = frequency, start= start))
+ return(ts(data, frequency = frequency, start= start))
}
#' @export
#' @rdname outliers_variables
@@ -140,7 +140,7 @@ tc_variable<-function(frequency, start, length, s, pos, date=NULL, rate=0.7){
} else{
data<-.jcall("jdplus/toolkit/base/r/modelling/Variables", "[D", "tc", jdom, as.character(date), rate)
}
- return (ts(data, frequency = frequency, start= start))
+ return(ts(data, frequency = frequency, start= start))
}
#' @export
@@ -157,7 +157,7 @@ ls_variable<-function(frequency, start, length, s, pos, date=NULL, zeroended=TRU
} else{
data<-.jcall("jdplus/toolkit/base/r/modelling/Variables", "[D", "ls", jdom, as.character(date), as.logical(zeroended))
}
- return (ts(data, frequency = frequency, start= start))
+ return(ts(data, frequency = frequency, start= start))
}
#' @export
@@ -175,7 +175,7 @@ so_variable<-function(frequency, start, length, s, pos, date=NULL, zeroended=TRU
data<-.jcall("jdplus/toolkit/base/r/modelling/Variables", "[D", "so", jdom, as.character(date),
as.logical(zeroended))
}
- return (ts(data, frequency = frequency, start= start))
+ return(ts(data, frequency = frequency, start= start))
}
#' Ramp regressor
@@ -219,7 +219,7 @@ ramp_variable<-function(frequency, start, length, s, range){
as.integer(range[1]-1),
as.integer(range[2]-1))
}
- return (ts(data, frequency = frequency, start= start))
+ return(ts(data, frequency = frequency, start= start))
}
#' Intervention variable
@@ -288,7 +288,7 @@ intervention_variable<-function(frequency, start, length, s, starts, ends, delta
.jarray(as.integer(starts-1)),
.jarray(as.integer(ends-1)))
}
- return (ts(data, frequency = frequency, start= start))
+ return(ts(data, frequency = frequency, start= start))
}
#' Periodic dummies and contrasts
@@ -314,7 +314,7 @@ periodic.dummies <-function(frequency, start, length, s){
jdom <- .r2jd_tsdomain(frequency, start[1], start[2], length)
jm<-.jcall("jdplus/toolkit/base/r/modelling/Variables", "Ljdplus/toolkit/base/api/math/matrices/Matrix;", "periodicDummies", jdom)
data <- .jd2r_matrix(jm)
- return (ts(data, frequency = frequency, start= start))
+ return(ts(data, frequency = frequency, start= start))
}
#'@export
#'@rdname periodic.dummies
@@ -327,7 +327,7 @@ periodic.contrasts <-function(frequency, start, length, s){
jdom <- .r2jd_tsdomain(frequency, start[1], start[2], length)
jm<-.jcall("jdplus/toolkit/base/r/modelling/Variables", "Ljdplus/toolkit/base/api/math/matrices/Matrix;", "periodicContrasts", jdom)
data <- .jd2r_matrix(jm)
- return (ts(data, frequency = frequency, start= start))
+ return(ts(data, frequency = frequency, start= start))
}
#' Trigonometric variables
#'
diff --git a/README.Rmd b/README.Rmd
index 418b915c..e2eb2786 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -13,13 +13,20 @@ knitr::opts_chunk$set(
)
```
-# rjd3toolkit
+
+# `rjd3toolkit`
+[![CRAN status](https://www.r-pkg.org/badges/version/rjd3toolkit)](https://CRAN.R-project.org/package=rjd3toolkit)
+
[![R-CMD-check](https://github.com/rjdverse/rjd3toolkit/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rjdverse/rjd3toolkit/actions/workflows/R-CMD-check.yaml)
+[![lint](https://github.com/rjdverse/rjd3toolkit/actions/workflows/lint.yaml/badge.svg)](https://github.com/rjdverse/rjd3toolkit/actions/workflows/lint.yaml)
+
+[![GH Pages built](https://github.com/rjdverse/rjd3toolkit/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/rjdverse/rjd3toolkit/actions/workflows/pkgdown.yaml)
+
Utility package in JDemetra+ 3.x R ecosystem. Contains functions used in other `rjd3` packages and has to be systematically installed before using any other rjd3 package.
## Main Functions
diff --git a/README.md b/README.md
index 863528dc..4747c450 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,18 @@
-# rjd3toolkit
+# `rjd3toolkit`
+[![CRAN
+status](https://www.r-pkg.org/badges/version/rjd3toolkit)](https://CRAN.R-project.org/package=rjd3toolkit)
+
[![R-CMD-check](https://github.com/rjdverse/rjd3toolkit/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rjdverse/rjd3toolkit/actions/workflows/R-CMD-check.yaml)
+[![lint](https://github.com/rjdverse/rjd3toolkit/actions/workflows/lint.yaml/badge.svg)](https://github.com/rjdverse/rjd3toolkit/actions/workflows/lint.yaml)
+
+[![GH Pages
+built](https://github.com/rjdverse/rjd3toolkit/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/rjdverse/rjd3toolkit/actions/workflows/pkgdown.yaml)
Utility package in JDemetra+ 3.x R ecosystem. Contains functions used in
diff --git a/man/figures/logo.png b/man/figures/logo.png
new file mode 100644
index 00000000..4bf3330a
Binary files /dev/null and b/man/figures/logo.png differ
diff --git a/man/figures/logo.svg b/man/figures/logo.svg
new file mode 100644
index 00000000..2011218d
--- /dev/null
+++ b/man/figures/logo.svg
@@ -0,0 +1,579 @@
+
+
+
diff --git a/pkgdown/favicon/apple-touch-icon-120x120.png b/pkgdown/favicon/apple-touch-icon-120x120.png
new file mode 100644
index 00000000..7b60e221
Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-120x120.png differ
diff --git a/pkgdown/favicon/apple-touch-icon-152x152.png b/pkgdown/favicon/apple-touch-icon-152x152.png
new file mode 100644
index 00000000..88972477
Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-152x152.png differ
diff --git a/pkgdown/favicon/apple-touch-icon-180x180.png b/pkgdown/favicon/apple-touch-icon-180x180.png
new file mode 100644
index 00000000..0b1bbbff
Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-180x180.png differ
diff --git a/pkgdown/favicon/apple-touch-icon-60x60.png b/pkgdown/favicon/apple-touch-icon-60x60.png
new file mode 100644
index 00000000..4aea1f36
Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-60x60.png differ
diff --git a/pkgdown/favicon/apple-touch-icon-76x76.png b/pkgdown/favicon/apple-touch-icon-76x76.png
new file mode 100644
index 00000000..9755d5c0
Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-76x76.png differ
diff --git a/pkgdown/favicon/apple-touch-icon.png b/pkgdown/favicon/apple-touch-icon.png
new file mode 100644
index 00000000..fc9586a6
Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon.png differ
diff --git a/pkgdown/favicon/favicon-16x16.png b/pkgdown/favicon/favicon-16x16.png
new file mode 100644
index 00000000..faa9be74
Binary files /dev/null and b/pkgdown/favicon/favicon-16x16.png differ
diff --git a/pkgdown/favicon/favicon-32x32.png b/pkgdown/favicon/favicon-32x32.png
new file mode 100644
index 00000000..146ba93b
Binary files /dev/null and b/pkgdown/favicon/favicon-32x32.png differ
diff --git a/pkgdown/favicon/favicon.ico b/pkgdown/favicon/favicon.ico
new file mode 100644
index 00000000..00c64f17
Binary files /dev/null and b/pkgdown/favicon/favicon.ico differ