Skip to content

Commit

Permalink
lint assignation <- instead of Ã=
Browse files Browse the repository at this point in the history
  • Loading branch information
TanguyBarthelemy committed Feb 21, 2024
1 parent 8b07411 commit 28d6cbd
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 71 deletions.
4 changes: 2 additions & 2 deletions R/export_workspace.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @rdname new_workspace
#' @export
new_workspace <- function() {
dictionary = .jnull("jdr/spec/ts/Utility$Dictionary")
dictionary <- .jnull("jdr/spec/ts/Utility$Dictionary")
wk <- .jcall("ec/tstoolkit/jdr/ws/Workspace",
"Lec/tstoolkit/jdr/ws/Workspace;",
"create", dictionary)
Expand Down Expand Up @@ -314,7 +314,7 @@ complete_dictionary.jSA <- function(workspace, sa_obj){
core <- .jcast(core, "ec/satoolkit/x13/X13Specification")
spec <- .jnew("jdr/spec/x13/X13Spec", core)
} else{
spec = sa_obj$spec
spec <- sa_obj$spec
}
}
jregression <- spec$getRegression()
Expand Down
2 changes: 1 addition & 1 deletion R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ proc_dictionary<-function(name){
keys<-array(dim=size)
jiter<-.jcall(jkeys, "Ljava/util/Iterator;", "iterator")
for (i in 1:size){
keys[i]=.jcall(.jcall(jiter, "Ljava/lang/Object;", "next"), "Ljava/lang/String;", "toString")
keys[i] <- .jcall(.jcall(jiter, "Ljava/lang/Object;", "next"), "Ljava/lang/String;", "toString")
}
return (keys)
}
Expand Down
4 changes: 2 additions & 2 deletions R/regarima.R
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ regarima_X13 <- function(jrobj, spec){
residuals.stat = jd_results$residuals.stat,
forecast = jd_results$forecast)

class(z) = c("regarima","X13")
class(z) <- c("regarima","X13")
return(z)
}

Expand Down Expand Up @@ -513,6 +513,6 @@ regarima_TS <- function(jrobj, spec){
residuals.stat = jd_results$residuals.stat,
forecast = jd_results$forecast)

class(z) = c("regarima","TRAMO_SEATS")
class(z) <- c("regarima","TRAMO_SEATS")
return(z)
}
8 changes: 4 additions & 4 deletions R/regarima_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#' @name plot
#' @rdname plot
#' @export
plot.regarima = function(x, which = 1:6,
plot.regarima <- function(x, which = 1:6,
caption = list("Residuals", "Histogram of residuals", "Normal Q-Q", "ACF of residuals",
"PACF of residuals", "Decomposition",
list("Y linearised", "Calendar effects", "Outliers effects"))[sort(which)],
Expand All @@ -22,9 +22,9 @@ plot.regarima = function(x, which = 1:6,
"PACF of residuals", "Decomposition",
list("Y linearised", "Calendar effects", "Outliers effects"))
all_caption[which] <- caption
sub.caption = NULL
cex.caption = 1
cex.oma.main = 1.25
sub.caption <- NULL
cex.caption <- 1
cex.oma.main <- 1.25
# Define additional variables for selected graphs:
if (any(show[2L:3L])) {
sres <- x$residuals / x$residuals.stat$st.error
Expand Down
40 changes: 20 additions & 20 deletions R/regarima_print.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ summary.regarima <- function(object, ...){
fvar <- fout <- NULL

if (!is.null(arima_coef)){
a_tvalues=matrix(2*(1 - pt(abs(arima_coef[,3]), loglik[3])),ncol=1)
colnames(a_tvalues)=c("Pr(>|t|)")
a_tvalues <- matrix(2*(1 - pt(abs(arima_coef[,3]), loglik[3])),ncol=1)
colnames(a_tvalues) <- c("Pr(>|t|)")
arima_coef <- cbind(arima_coef,a_tvalues)
}
if (!is.null(reg_coef)){
r_tvalues=matrix(2*(1 - pt(abs(reg_coef[,3]), loglik[3])),ncol=1)
colnames(r_tvalues)=c("Pr(>|t|)")
r_tvalues <- matrix(2*(1 - pt(abs(reg_coef[,3]), loglik[3])),ncol=1)
colnames(r_tvalues) <- c("Pr(>|t|)")
reg_coef <- cbind(reg_coef, r_tvalues)
}
if (usr_spec[1] & usr_spec[2]){
Expand Down Expand Up @@ -172,20 +172,20 @@ print.regarima <- function (x, digits = max(3L, getOption("digits") - 3L), ...){
cat("Coefficients:")
if (!is.null(arima_coef)){
if (!is.matrix(arima_coef[,-3])){
tab.arima=t(as.matrix(arima_coef[,-3]))
rownames(tab.arima)=rownames(arima_coef)
tab.arima <- t(as.matrix(arima_coef[,-3]))
rownames(tab.arima) <- rownames(arima_coef)
}else{
tab.arima=arima_coef[,-3]
tab.arima <- arima_coef[,-3]
}
cat("\n")
printCoefmat(tab.arima, digits = digits, P.values= FALSE, na.print = "NA", ...)
}
if (!is.null(reg_coef)){
if (!is.matrix(reg_coef[,-3])){
tab.reg=t(as.matrix(reg_coef[,-3]))
rownames(tab.reg)=rownames(reg_coef)
tab.reg <- t(as.matrix(reg_coef[,-3]))
rownames(tab.reg) <- rownames(reg_coef)
}else{
tab.reg=reg_coef[,-3]
tab.reg <- reg_coef[,-3]
}
cat("\n")
printCoefmat(tab.reg, digits = digits, P.values= FALSE, na.print = "NA", ...)
Expand Down Expand Up @@ -235,7 +235,7 @@ print.regarima <- function (x, digits = max(3L, getOption("digits") - 3L), ...){
}
# Method: "regarima_rtest" for the print
#' @export
print.regarima_rtests=function (x, digits = max(3L, getOption("digits") - 3L),
print.regarima_rtests <- function (x, digits = max(3L, getOption("digits") - 3L),
enable_print_style = getOption("enable_print_style"), ...){
if(enable_print_style){
bold_pre_code <- "\033[1m"
Expand All @@ -249,15 +249,15 @@ print.regarima_rtests=function (x, digits = max(3L, getOption("digits") - 3L),
stat <- x[,1]
pval <- x[,2]

sigcode=vector(mode = "character", length = 6)
sigcode[pval >=0.1] = triplestar
sigcode[pval < 0.1 & pval >= 0.05] = doublestar
sigcode[pval < 0.05] = " "
tabstat=data.frame(stat,pval,sigcode)
rownames(tabstat)=rownames(x)
colnames(tabstat)=c("Statistic","P.value","")
tabstat[,1]=format(tabstat[,1], digits = digits)
tabstat[,2]=format(round(tabstat[,2],max(4,digits)))
sigcode <- vector(mode = "character", length = 6)
sigcode[pval >=0.1] <- triplestar
sigcode[pval < 0.1 & pval >= 0.05] <- doublestar
sigcode[pval < 0.05] <- " "
tabstat <- data.frame(stat,pval,sigcode)
rownames(tabstat) <- rownames(x)
colnames(tabstat) <- c("Statistic","P.value","")
tabstat[,1] <- format(tabstat[,1], digits = digits)
tabstat[,2] <- format(round(tabstat[,2],max(4,digits)))

cat("\n")
cat(bold_pre_code,
Expand Down
6 changes: 3 additions & 3 deletions R/regarima_rslts.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ regarima_rslts <- function(jrobj, fcsth){
rownames(arima.coefficients) <- arma.description
colnames(arima.coefficients) <- c("Estimate","Std. Error","T-stat")
}else{
arima.coefficients = NULL
arima.coefficients <- NULL
}

# Regression coefficients
Expand Down Expand Up @@ -82,8 +82,8 @@ regarima_rslts <- function(jrobj, fcsth){
transformed <- as.logical(result(jrobj,"model.log"))
mean <- "Mean" %in% rownames(regression.coefficients)
ntd <- result(jrobj,"model.ntd")
if (is.null(result(jrobj,"model.lp"))){leap.year=FALSE} else {leap.year=TRUE}
if (is.null(result(jrobj,"model.easter"))){easter=FALSE} else {easter=TRUE}
if (is.null(result(jrobj,"model.lp"))){leap.year <- FALSE} else {leap.year <- TRUE}
if (is.null(result(jrobj,"model.easter"))){easter <- FALSE} else {easter <- TRUE}
nout <- result(jrobj,"model.nout")

spec_rslt <- data.frame(model, t.span, transformed, mean, ntd, leap.year, easter, nout,
Expand Down
12 changes: 6 additions & 6 deletions R/regarima_specTS.R
Original file line number Diff line number Diff line change
Expand Up @@ -575,15 +575,15 @@ regarima_spec_tramoseats.character <- function(spec = c("TRfull", "TR0", "TR1",

# To check the mode of the remaining variables
list.logical.usrdef <-list("usrdef.outliersEnabled","usrdef.varEnabled","arima.coefEnabled")
list.logical = list("preliminary.check", "estimate.eml","tradingdays.leapyear","easter.julian","easter.test","outlier.enabled","outlier.ao",
list.logical <- list("preliminary.check", "estimate.eml","tradingdays.leapyear","easter.julian","easter.test","outlier.enabled","outlier.ao",
"outlier.tc","outlier.ls","outlier.so","outlier.usedefcv","outlier.eml","automdl.enabled",
"automdl.acceptdefault","automdl.compare","arima.mu")
list.logical.check <- append(list.logical.usrdef,list.logical)

list.numeric.span <- list("estimate.first","estimate.last","estimate.exclFirst","estimate.exclLast",
"outlier.first","outlier.last","outlier.exclFirst","outlier.exclLast","fcst.horizon")

list.numeric = list("estimate.tol","estimate.urfinal","transform.fct","tradingdays.pftd",
list.numeric <- list("estimate.tol","estimate.urfinal","transform.fct","tradingdays.pftd",
"tradingdays.stocktd","easter.duration","outlier.cv","outlier.tcrate",
"automdl.cancel","automdl.ub1","automdl.ub2","automdl.armalimit","automdl.reducecv",
"automdl.ljungboxlimit","arima.p","arima.d","arima.q","arima.bp","arima.bd","arima.bq")
Expand Down Expand Up @@ -667,7 +667,7 @@ regarima_spec_tramoseats.character <- function(spec = c("TRfull", "TR0", "TR1",
arima=arima,
forecast = forecast,
span=span)
class(z) = c("regarima_spec","TRAMO_SEATS")
class(z) <- c("regarima_spec","TRAMO_SEATS")
return(z)
}
# The function creates a ("regarima_spec","TRAMO_SEATS") class object from a regarima_Spec or a regarima object
Expand Down Expand Up @@ -780,12 +780,12 @@ regarima_spec_tramoseats.TRAMO_SEATS <- function(spec,


# To check the mode of the remaining variables
list.logical = list("preliminary.check","usrdef.outliersEnabled","usrdef.varEnabled","estimate.eml","tradingdays.leapyear",
list.logical <- list("preliminary.check","usrdef.outliersEnabled","usrdef.varEnabled","estimate.eml","tradingdays.leapyear",
"easter.julian","easter.test","outlier.enabled","outlier.ao",
"outlier.tc","outlier.ls","outlier.so","outlier.usedefcv","outlier.eml","automdl.enabled",
"automdl.acceptdefault","automdl.compare","arima.mu","arima.coefEnabled")

list.numeric = list("estimate.first","estimate.last","estimate.exclFirst","estimate.exclLast",
list.numeric <- list("estimate.first","estimate.last","estimate.exclFirst","estimate.exclLast",
"outlier.first","outlier.last","outlier.exclFirst","outlier.exclLast",
"estimate.tol","estimate.urfinal","transform.fct","tradingdays.pftd",
"tradingdays.stocktd","easter.duration","outlier.cv","outlier.tcrate",
Expand Down Expand Up @@ -874,7 +874,7 @@ regarima_spec_tramoseats.TRAMO_SEATS <- function(spec,
arima=arima,
forecast = forecast,
span=span)
class(z) = c("regarima_spec","TRAMO_SEATS")
class(z) <- c("regarima_spec","TRAMO_SEATS")
return(z)

}
2 changes: 1 addition & 1 deletion R/regarima_specX13.R
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ new_regarima_spec_x13 <- function(estimate = NULL,
arima = arima,
forecast = forecast,
span = span)
class(z) = c("regarima_spec","X13")
class(z) <- c("regarima_spec","X13")
z
}
reformat_spec_def <- function(x, parameter){
Expand Down
20 changes: 10 additions & 10 deletions R/sa_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#' @name plot
#' @rdname plot
#' @export
plot.decomposition_X11 = function(x, first_date, last_date, caption = "S-I ratio", ylim, ...){
plot.decomposition_X11 <- function(x, first_date, last_date, caption = "S-I ratio", ylim, ...){
if (!inherits(x, "decomposition_X11"))
stop("This function must only be used with a \"decomposition_X11\" object")

Expand Down Expand Up @@ -74,9 +74,9 @@ plot.decomposition_X11 = function(x, first_date, last_date, caption = "S-I ratio
}else if (freq==2) {
leg<-c("H1","H2")
} else {
leg=c("")
leg <- c("")
}
yaxt="s"
yaxt <- "s"
for (i in 1:freq){
mm <- cycle(d10)==i
xd10 <- d10[mm]
Expand All @@ -85,9 +85,9 @@ plot.decomposition_X11 = function(x, first_date, last_date, caption = "S-I ratio
points(xd8, col="red", pch="*", xlab="")
lines(rep(mean(xd10),length(xd10)), col="black", type="l", lty=1)
legend(x = "bottom", legend=leg[i],inset = 0, bty="n")
yaxt = "n"
yaxt <- "n"
par(cex = 0.7, mai = c(0.1,0,0.4,0))
ylab = ""
ylab <- ""
}
mtext(caption[1], side = 3, col = "blue", outer = TRUE, line = -2)
par(cex = op$cex, mai = op$mai, mfcol = op$mfcol, mfrow = op$mfrow)
Expand All @@ -96,7 +96,7 @@ plot.decomposition_X11 = function(x, first_date, last_date, caption = "S-I ratio
#' @name plot
#' @rdname plot
#' @export
plot.decomposition_SEATS = function(x, first_date, last_date, caption = "S-I ratio", ylim, ...){
plot.decomposition_SEATS <- function(x, first_date, last_date, caption = "S-I ratio", ylim, ...){
if (!inherits(x, "decomposition_SEATS"))
stop("This function must only be used with a \"decomposition_SEATS\" object")

Expand Down Expand Up @@ -132,19 +132,19 @@ plot.decomposition_SEATS = function(x, first_date, last_date, caption = "S-I rat
}else if (freq==2) {
leg<-c("H1","H2")
} else {
leg=c("")
leg <- c("")
}
yaxt="s"
yaxt <- "s"
for (i in 1:freq){
mm <- cycle(z)==i
zm <- z[mm]
plot(zm, type="l", col="blue", lty=1, xaxt="n", yaxt = yaxt, ylim=ylim)
lines(rep(mean(zm),length(zm)), col="black", type="l", lty=1)
points(zm, col="red", pch="*", xlab="")
legend(x = "bottom", legend=leg[i],inset = 0, bty="n")
yaxt = "n"
yaxt <- "n"
par(cex=0.7, mai=c(0.1,0,0.4,0))
ylab=""
ylab <- ""
}
mtext(caption[1], side = 3, col = "blue", outer = TRUE, line = -2)
par(cex = op$cex, mai = op$mai, mfcol = op$mfcol, mfrow = op$mfrow)
Expand Down
6 changes: 3 additions & 3 deletions R/sa_print.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' @export
print.decomposition_X11=function (x, digits = max(3L, getOption("digits") - 3L),
print.decomposition_X11 <- function (x, digits = max(3L, getOption("digits") - 3L),
enable_print_style = getOption("enable_print_style"), ...){
if(enable_print_style){
bold_pre_code <- "\033[1m"
Expand All @@ -24,7 +24,7 @@ print.decomposition_X11=function (x, digits = max(3L, getOption("digits") - 3L),
cat("\n")
}
#' @export
print.decomposition_SEATS=function (x, digits = max(3L, getOption("digits") - 3L),
print.decomposition_SEATS <- function (x, digits = max(3L, getOption("digits") - 3L),
enable_print_style = getOption("enable_print_style"),...){
if(enable_print_style){
bold_pre_code <- "\033[1m"
Expand Down Expand Up @@ -101,7 +101,7 @@ print.combined_test <- function(x, digits = max(3L, getOption("digits") - 3L),
}

#' @export
print.diagnostics = function (x, digits = max(3L, getOption("digits") - 3L),
print.diagnostics <- function (x, digits = max(3L, getOption("digits") - 3L),
enable_print_style = getOption("enable_print_style"),
...){

Expand Down
22 changes: 11 additions & 11 deletions R/saveSpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
#' @rdname save_spec
#' @name save_spec
#' @export
save_spec = function (object, file = file.path(tempdir(), "spec.RData")) {
save_spec <- function (object, file = file.path(tempdir(), "spec.RData")) {
if (inherits(object, c("regarima","regarima_spec","SA","SA_spec"))==FALSE)
stop("The function must only be used with \"regarima\", \"regarima_spec\", \"SA\" and \"SA_spec\" objects", call. = FALSE)

Expand Down Expand Up @@ -154,14 +154,14 @@ load_spec <- function (file = "spec.RData") {
arima.dsc <- rbind(s.arima.dsc,rep(NA,length(s.arima.dsc)),s.arima.dsc)
forecast <- rbind(s.forecast,rep(NA,length(s.forecast)),s.forecast)

rownames(estimate)=c("Loaded","User_modif","Final")
rownames(transform)=c("Loaded","User_modif","Final")
rownames(usrdef)=c("Loaded","User_modif","Final")
rownames(trading.days)=c("Loaded","User_modif","Final")
rownames(easter)=c("Loaded","User_modif","Final")
rownames(outliers)=c("Loaded","User_modif","Final")
rownames(arima.dsc)=c("Loaded","User_modif","Final")
rownames(forecast)=c("Loaded","User_modif","Final")
rownames(estimate) <- c("Loaded","User_modif","Final")
rownames(transform) <- c("Loaded","User_modif","Final")
rownames(usrdef) <- c("Loaded","User_modif","Final")
rownames(trading.days) <- c("Loaded","User_modif","Final")
rownames(easter) <- c("Loaded","User_modif","Final")
rownames(outliers) <- c("Loaded","User_modif","Final")
rownames(arima.dsc) <- c("Loaded","User_modif","Final")
rownames(forecast) <- c("Loaded","User_modif","Final")

userdef <-list(specification = usrdef, outliers = list(Predefined = s.predef.outliers, Final = s.predef.outliers),
variables = list(Predefined = s.predef.variables, Final = s.predef.variables))
Expand All @@ -180,15 +180,15 @@ load_spec <- function (file = "spec.RData") {
} else if (inherits(object,"SA_saveX13")){
class(regarima) <- c("regarima_spec","X13")
x11 <- rbind(s.decomp,rep(NA,length(s.decomp )),s.decomp)
rownames(x11)=c("Loaded","User_modif","Final")
rownames(x11) <- c("Loaded","User_modif","Final")
class(x11) <- c("X11_spec","data.frame")
z <- list(regarima = regarima, x11 = x11)
class(z) <- c("SA_spec","X13")
return(z)
} else {
class(regarima) <- c("regarima_spec","TRAMO_SEATS")
seats <- rbind(s.decomp,rep(NA,length(s.decomp )),s.decomp)
rownames(seats)=c("Loaded","User_modif","Final")
rownames(seats) <- c("Loaded","User_modif","Final")
class(seats) <- c("seats_spec","data.frame")
z <- list(regarima = regarima, seats = seats)
class(z) <- c("SA_spec","TRAMO_SEATS")
Expand Down
8 changes: 4 additions & 4 deletions R/spec_rjd.R
Original file line number Diff line number Diff line change
Expand Up @@ -847,9 +847,9 @@ preOut_r2jd <- function(jsobjct = NA, coefEna = NA, out = NA, outDate = NA, outC
preVar_r2jd <- function(jsobjct = NA, jsdict = NA, coefEna = NA,
prevar_spec = list(series = NA, description = data.frame(NA,NA)),
jtd = NA) {
series = prevar_spec$series
varType = prevar_spec$description[,1]
varCoef = prevar_spec$description[,2]
series <- prevar_spec$series
varType <- prevar_spec$description[,1]
varCoef <- prevar_spec$description[,2]
varNames <- rownames(prevar_spec$description)

nvar <- if (is.mts(series)) {dim(series)[2]} else if (is.ts(series)) {1} else {0}
Expand All @@ -861,7 +861,7 @@ preVar_r2jd <- function(jsobjct = NA, jsdict = NA, coefEna = NA,

calendar_def <- grep("Calendar",type)
n_calendar_def <- length(calendar_def)
jcoreg = jsobjct$getCore()$getRegression()
jcoreg <- jsobjct$getCore()$getRegression()

if (nvar == 1){
if(n_calendar_def == 1){
Expand Down
Loading

0 comments on commit 28d6cbd

Please sign in to comment.