From b7f152670ede15ad2f0f1ef91003cc19343a795b Mon Sep 17 00:00:00 2001 From: AQLT Date: Wed, 27 Sep 2023 11:22:12 +0200 Subject: [PATCH] sa.decomposition -> sa_decomposition sa.preprocessing -> sa_preprocessing --- NAMESPACE | 3 +- R/decomposition.R | 6 ++-- R/generics.R | 28 ++++++++++++++----- man/deprecated-rjd3toolkit.Rd | 17 +++++++++++ ...a.decomposition.Rd => sa_decomposition.Rd} | 6 ++-- ...a.preprocessing.Rd => sa_preprocessing.Rd} | 6 ++-- vignettes/calendar_correction_functions.R | 9 ------ 7 files changed, 49 insertions(+), 26 deletions(-) create mode 100644 man/deprecated-rjd3toolkit.Rd rename man/{sa.decomposition.Rd => sa_decomposition.Rd} (92%) rename man/{sa.preprocessing.Rd => sa_preprocessing.Rd} (77%) delete mode 100644 vignettes/calendar_correction_functions.R diff --git a/NAMESPACE b/NAMESPACE index 17a25fd..18ed510 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -199,7 +199,8 @@ export(remove_outlier) export(remove_ramp) export(result) export(sa.decomposition) -export(sa.preprocessing) +export(sa_decomposition) +export(sa_preprocessing) export(sadecomposition) export(sarima_decompose) export(sarima_estimate) diff --git a/R/decomposition.R b/R/decomposition.R index 404a1c8..f605632 100644 --- a/R/decomposition.R +++ b/R/decomposition.R @@ -4,7 +4,7 @@ NULL -#' @rdname sa.decomposition +#' @rdname sa_decomposition #' @export sadecomposition<-function(y, sa, t, s, i, mul){ if (! is.logical(mul))stop("Invalid SA decomposition") @@ -33,7 +33,7 @@ sadecomposition<-function(y, sa, t, s, i, mul){ return (structure(list(series=y, sa=sa, trend=t, seas=s, irr=i, multiplicative=mul), class=c("JD3_SADECOMPOSITION", "JD3"))) } -#' @rdname sa.decomposition +#' @rdname sa_decomposition #' @export print.JD3_SADECOMPOSITION<-function(x, n_last_obs = frequency(x$series), ...){ cat("Last values\n") @@ -43,7 +43,7 @@ print.JD3_SADECOMPOSITION<-function(x, n_last_obs = frequency(x$series), ...){ ) ) } -#' @rdname sa.decomposition +#' @rdname sa_decomposition #' @export plot.JD3_SADECOMPOSITION <- function(x, first_date = NULL, last_date = NULL, type_chart = c("sa-trend", "seas-irr"), diff --git a/R/generics.R b/R/generics.R index 3d6f552..b65c4cc 100644 --- a/R/generics.R +++ b/R/generics.R @@ -6,7 +6,7 @@ #' #' @export diagnostics<-function(x, ...){ - UseMethod("diagnostics") + UseMethod("diagnostics", x) } @@ -24,15 +24,15 @@ diagnostics.JD3<-function(x, ...){ #' @param x,... parameters. #' #' @export -sa.preprocessing<-function(x, ...){ - UseMethod("sa.preprocessing") +sa_preprocessing<-function(x, ...){ + UseMethod("sa_preprocessing", x) } #' Generic Function for Seasonal Adjustment Decomposition #' #' Generic function to format the seasonal adjustment decomposition components. -#' \code{sa.decomposition()} is a generic function defined in other packages. +#' \code{sa_decomposition()} is a generic function defined in other packages. #' #' @param y,sa,t,s,i,mul seasonal adjustment decomposition parameters. #' @param x the object to print. @@ -45,11 +45,25 @@ sa.preprocessing<-function(x, ...){ #' @param ... further arguments. #' #' @return \code{"JD3_SADECOMPOSITION"} object. -#' @name sa.decomposition +#' @name sa_decomposition NULL #' @export -#' @rdname sa.decomposition +#' @rdname sa_decomposition +sa_decomposition<-function(x, ...){ + UseMethod("sa_decomposition", x) +} + +#' Deprecated functions +#' +#' @description +#' Use [sa_decomposition()] instead of `sa.decomposition()`. +#' +#' @inheritParams sa_decomposition +#' @name deprecated-rjd3toolkit +#' @export +#' @export sa.decomposition<-function(x, ...){ - UseMethod("sa.decomposition") + .Deprecated("sa_decomposition") + UseMethod("sa_decomposition", x) } diff --git a/man/deprecated-rjd3toolkit.Rd b/man/deprecated-rjd3toolkit.Rd new file mode 100644 index 0000000..1ba7179 --- /dev/null +++ b/man/deprecated-rjd3toolkit.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/generics.R +\name{deprecated-rjd3toolkit} +\alias{deprecated-rjd3toolkit} +\alias{sa.decomposition} +\title{Deprecated functions} +\usage{ +sa.decomposition(x, ...) +} +\arguments{ +\item{x}{the object to print.} + +\item{...}{further arguments.} +} +\description{ +Use \code{\link[=sa_decomposition]{sa_decomposition()}} instead of \code{sa.decomposition()}. +} diff --git a/man/sa.decomposition.Rd b/man/sa_decomposition.Rd similarity index 92% rename from man/sa.decomposition.Rd rename to man/sa_decomposition.Rd index f943dc7..4631ba5 100644 --- a/man/sa.decomposition.Rd +++ b/man/sa_decomposition.Rd @@ -4,7 +4,7 @@ \alias{sadecomposition} \alias{print.JD3_SADECOMPOSITION} \alias{plot.JD3_SADECOMPOSITION} -\alias{sa.decomposition} +\alias{sa_decomposition} \title{Generic Function for Seasonal Adjustment Decomposition} \usage{ sadecomposition(y, sa, t, s, i, mul) @@ -21,7 +21,7 @@ sadecomposition(y, sa, t, s, i, mul) ... ) -sa.decomposition(x, ...) +sa_decomposition(x, ...) } \arguments{ \item{y, sa, t, s, i, mul}{seasonal adjustment decomposition parameters.} @@ -46,5 +46,5 @@ the seasonally adjusted and the trend; \code{"seas-irr"} plots the seasonal and } \description{ Generic function to format the seasonal adjustment decomposition components. -\code{sa.decomposition()} is a generic function defined in other packages. +\code{sa_decomposition()} is a generic function defined in other packages. } diff --git a/man/sa.preprocessing.Rd b/man/sa_preprocessing.Rd similarity index 77% rename from man/sa.preprocessing.Rd rename to man/sa_preprocessing.Rd index d440273..76f10ec 100644 --- a/man/sa.preprocessing.Rd +++ b/man/sa_preprocessing.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/generics.R -\name{sa.preprocessing} -\alias{sa.preprocessing} +\name{sa_preprocessing} +\alias{sa_preprocessing} \title{Generic Preprocessing Function} \usage{ -sa.preprocessing(x, ...) +sa_preprocessing(x, ...) } \arguments{ \item{x, ...}{parameters.} diff --git a/vignettes/calendar_correction_functions.R b/vignettes/calendar_correction_functions.R deleted file mode 100644 index e09fb4d..0000000 --- a/vignettes/calendar_correction_functions.R +++ /dev/null @@ -1,9 +0,0 @@ -## ---- include = FALSE--------------------------------------------------------- -knitr::opts_chunk$set( - collapse = TRUE, - comment = "#>" -) - -## ----setup-------------------------------------------------------------------- -library(rjd3toolkit) -