From df1845f1bb2ce5586f7b9ef15c475eb9c6253956 Mon Sep 17 00:00:00 2001 From: Earo Wang Date: Tue, 30 Jul 2024 21:30:52 +1000 Subject: [PATCH] cran maintenance --- .Rbuildignore | 1 + CRAN-SUBMISSION | 3 +++ DESCRIPTION | 4 ++-- NAMESPACE | 1 - NEWS.md | 4 ++++ R/MinT.R | 2 +- R/gts.R | 2 +- R/imports.R | 4 ++-- R/tracemin.R | 22 +++++++++++----------- cran-comments.md | 7 +------ man/MinT.Rd | 2 +- man/plot.gts.Rd | 2 +- src/RcppExports.cpp | 5 +++++ vignettes/hts.R | 1 + 14 files changed, 34 insertions(+), 26 deletions(-) create mode 100644 CRAN-SUBMISSION create mode 100644 vignettes/hts.R diff --git a/.Rbuildignore b/.Rbuildignore index 4582e44..2ffe3e9 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -12,3 +12,4 @@ ^CRAN-RELEASE$ ^codecov\.yml$ ^\.github$ +^CRAN-SUBMISSION$ diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 0000000..bc0689a --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 6.0.3 +Date: 2024-07-30 11:20:38 UTC +SHA: 3f444cf6d6aca23a3a7f2d482df2e33bb078dc55 diff --git a/DESCRIPTION b/DESCRIPTION index b4602dc..ec74e41 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: hts Title: Hierarchical and Grouped Time Series -Version: 6.0.2 +Version: 6.0.3 Authors@R: c( person("Rob", "Hyndman", role = "aut", comment = "Package creator"), person("Alan", "Lee", role = "aut", comment = "Fast computation using recursive methods"), @@ -39,6 +39,6 @@ URL: https://pkg.earo.me/hts/ BugReports: https://github.com/earowang/hts/issues License: GPL (>= 2) VignetteBuilder: knitr -RoxygenNote: 7.1.1 +RoxygenNote: 7.2.3 Roxygen: list(markdown = TRUE, roclets=c('rd', 'collate', 'namespace')) Encoding: UTF-8 diff --git a/NAMESPACE b/NAMESPACE index 3d6a317..107d1dc 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -27,7 +27,6 @@ export(smatrix) export(summary.gts) export(summary.hts) import(Matrix) -import(SparseM) import(forecast) import(grDevices) import(methods) diff --git a/NEWS.md b/NEWS.md index f340e01..e4c9d19 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# hts 6.0.3 + +* Cran maintenance + # hts 6.0.2 * Removed dependency on matrixcalc diff --git a/R/MinT.R b/R/MinT.R index e70c04e..6b6bb24 100644 --- a/R/MinT.R +++ b/R/MinT.R @@ -80,7 +80,7 @@ shrink.estim <- function(x, tar) #' \code{\link[hts]{forecast.gts}}, \code{\link[hts]{combinef}} #' @references Wickramasuriya, S. L., Athanasopoulos, G., & Hyndman, R. J. (2019). #' Optimal forecast reconciliation for hierarchical and grouped time series through trace minimization. -#' \emph{Journal of the American Statistical Association}, \bold{114}(526), 804--819. \url{https://robjhyndman.com/working-papers/mint/} +#' \emph{Journal of the American Statistical Association}, \bold{114}(526), 804--819. \url{https://robjhyndman.com/publications/mint/} #' #' Wickramasuriya, S. L., Turlach, B. A., & Hyndman, R. J. (to appear). Optimal non-negative forecast reconciliation. #' \emph{Statistics and Computing}. \url{https://robjhyndman.com/publications/nnmint/} diff --git a/R/gts.R b/R/gts.R index 918d315..9fecad4 100644 --- a/R/gts.R +++ b/R/gts.R @@ -270,7 +270,7 @@ CreateGmat <- function(bnames, characters) { gmatrix <- gmatrix[!duplicated(gmatrix), , drop = FALSE] # Remove bottom names if it has check <- try(which(gmatrix == bnames, arr.ind = TRUE)[1L, 1L], silent = TRUE) - if (class(check) != "try-error") { + if (class(check) != "try-error") { gmatrix <- gmatrix[-check, ] } return(gmatrix) diff --git a/R/imports.R b/R/imports.R index 29d70b6..d97e471 100644 --- a/R/imports.R +++ b/R/imports.R @@ -3,8 +3,8 @@ #' @importFrom utils combn #' @import methods #' @importFrom stats window as.ts fitted frequency is.ts na.omit residuals time ts tsp tsp<- -#' @import Matrix -#' @import SparseM +#' @import Matrix +#' @importFrom(SparseM,as.matrix.csr) #' @import forecast #' @import parallel #' @useDynLib hts diff --git a/R/tracemin.R b/R/tracemin.R index 771b99c..4ad98a5 100644 --- a/R/tracemin.R +++ b/R/tracemin.R @@ -22,22 +22,22 @@ LU <- function(fcasts, S, weights, allow.changes = FALSE) { nbts <- ncol(S) nagg <- nts - nbts seqagg <- 1L:nagg - + if (!allow.changes) { utmat <- cbind2(sparseMatrix(i = seqagg, j = seqagg, x = 1), - -1 * S[1L:nagg, ]) + -1 * S[1L:nagg, , drop = TRUE]) } else { # Identifying rows with one 1 element to make the Identity matrix in S indx <- rowSums(S) - idx <- tail(which(indx == 1L), nbts) - + idx <- tail(which(indx == 1L), nbts) + # Permulation vector to rearrange rows of S, rows/col of W and forecasts pvec <- c(setdiff(1:nts, idx) , idx) S2 <- S[pvec, ] weights <- weights[pvec, pvec] fcasts <- fcasts[pvec, ] - utmat <- cbind2(sparseMatrix(i = seqagg, j = seqagg, x = 1), - -1 * S2[1L:nagg, ]) + utmat <- cbind2(sparseMatrix(i = seqagg, j = seqagg, x = 1), + -1 * S2[1L:nagg, , drop = TRUE]) } jmat <- sparseMatrix(i = 1L:nbts, j = (nagg + 1L):nts, x = rep(1L, nbts), dims = c(nbts, nts)) @@ -74,14 +74,14 @@ CG <- function(fcasts, S, weights, allow.changes = FALSE) { } else { # Identifying rows with one 1 element to make the Identity matrix in S indx <- rowSums(S) - idx <- tail(which(indx == 1L), nbts) - + idx <- tail(which(indx == 1L), nbts) + # Permulation vector to rearrange rows of S, rows/col of W and forecasts pvec <- c(setdiff(1:nts, idx) , idx) S2 <- S[pvec, ] weights <- weights[pvec, pvec] fcasts <- fcasts[pvec, ] - utmat <- cbind2(Matrix::sparseMatrix(i = seqagg, j = seqagg, x = 1), + utmat <- cbind2(Matrix::sparseMatrix(i = seqagg, j = seqagg, x = 1), -1 * S2[1L:nagg, ]) } jmat <- Matrix::sparseMatrix(i = 1L:nbts, j = (nagg + 1L):nts, x = rep(1L, nbts), @@ -118,8 +118,8 @@ CHOL <- function(fcasts, S, weights, allow.changes = FALSE) { # Identifying rows with one 1 element to make the Identity matrix in S Sm <- as(S, "dgCMatrix") indx <- rowSums(Sm) - idx <- tail(which(indx == 1L), nbts) - + idx <- tail(which(indx == 1L), nbts) + # Permulation vector to rearrange rows of S, rows/col of W and forecasts pvec <- c(setdiff(1:nts, idx) , idx) S2 <- S[pvec, ] diff --git a/cran-comments.md b/cran-comments.md index 3734791..a52f0b1 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,11 +1,6 @@ ## Comments -This is a resubmission that urls have been fixed. - -## Test environments -* local R installation Ubuntu 21.04, R 4.1.0 -* macOS release, windows release, windows 3.6, ubuntu 16.04 devel, ubuntu 16.04 release, ubuntu 16.04 oldrel, ubuntu 16.04 3.5 on github actions -* win-builder (devel) +This is a submission to fix CRAN errors. ## R CMD check results diff --git a/man/MinT.Rd b/man/MinT.Rd index d99c1b0..ef2927a 100644 --- a/man/MinT.Rd +++ b/man/MinT.Rd @@ -135,7 +135,7 @@ plot(y.f) \references{ Wickramasuriya, S. L., Athanasopoulos, G., & Hyndman, R. J. (2019). Optimal forecast reconciliation for hierarchical and grouped time series through trace minimization. -\emph{Journal of the American Statistical Association}, \bold{114}(526), 804--819. \url{https://robjhyndman.com/working-papers/mint/} +\emph{Journal of the American Statistical Association}, \bold{114}(526), 804--819. \url{https://robjhyndman.com/publications/mint/} Wickramasuriya, S. L., Turlach, B. A., & Hyndman, R. J. (to appear). Optimal non-negative forecast reconciliation. \emph{Statistics and Computing}. \url{https://robjhyndman.com/publications/nnmint/} diff --git a/man/plot.gts.Rd b/man/plot.gts.Rd index 60d98cb..4b72c67 100644 --- a/man/plot.gts.Rd +++ b/man/plot.gts.Rd @@ -31,7 +31,7 @@ Method for plotting grouped or hierarchical time series and their forecasts. plot(htseg1, levels = c(0, 2)) plot(infantgts, include = 10, levels = "State") -plot(infantgts, include = 10, levels = "State", +plot(infantgts, include = 10, levels = "State", col = colours()[100:107], lty = 1:8, color_lab = TRUE) } diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index fdf4f64..f62de15 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -6,6 +6,11 @@ using namespace Rcpp; +#ifdef RCPP_USE_GLOBAL_ROSTREAM +Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); +Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); +#endif + // cgm_c Eigen::MatrixXd cgm_c(SEXP As, SEXP bs); RcppExport SEXP _hts_cgm_c(SEXP AsSEXP, SEXP bsSEXP) { diff --git a/vignettes/hts.R b/vignettes/hts.R new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/vignettes/hts.R @@ -0,0 +1 @@ +