From 78bb213751b991b1b608cdecc1528fe4336e76b4 Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Wed, 15 Mar 2023 11:45:15 +0100 Subject: [PATCH 1/2] Deprecate numeric value for parameter 'dim_anom' --- R/CST_Anomaly.R | 5 ----- tests/testthat/test-CST_Anomaly.R | 6 ++---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/R/CST_Anomaly.R b/R/CST_Anomaly.R index 489835c6..2437b5c6 100644 --- a/R/CST_Anomaly.R +++ b/R/CST_Anomaly.R @@ -97,11 +97,6 @@ CST_Anomaly <- function(exp = NULL, obs = NULL, dim_anom = 'sdate', dim_obs <- dim(obs$data) dimnames_data <- names(dim_exp) # dim_anom - if (is.numeric(dim_anom) & length(dim_anom) == 1) { - warning("Parameter 'dim_anom' must be a character string and a numeric value will not be ", - "accepted in the next release. The corresponding dimension name is assigned.") - dim_anom <- dimnames_data[dim_anom] - } if (!is.character(dim_anom)) { stop("Parameter 'dim_anom' must be a character string.") } diff --git a/tests/testthat/test-CST_Anomaly.R b/tests/testthat/test-CST_Anomaly.R index b4137015..a4c7f3f5 100644 --- a/tests/testthat/test-CST_Anomaly.R +++ b/tests/testthat/test-CST_Anomaly.R @@ -63,10 +63,9 @@ test_that("1. Input checks", { "Parameter 'exp' and 'obs' must have same dimension names in element 'data'." ) # dim_anom - expect_warning( + expect_error( CST_Anomaly(exp = exp, obs = obs, dim_anom = 3), - paste0("Parameter 'dim_anom' must be a character string and a numeric value will not be ", - "accepted in the next release. The corresponding dimension name is assigned.") + paste0("Parameter 'dim_anom' must be a character string.") ) expect_error( CST_Anomaly(exp = exp3, obs = obs3), @@ -113,7 +112,6 @@ test_that("1. Input checks", { ############################################## test_that("2. Output checks: dat", { - expect_equal( names(CST_Anomaly(exp, obs)), c("exp", "obs") -- GitLab From 8ee54a13ccb3c1125d3495ec7231c81e1f484572 Mon Sep 17 00:00:00 2001 From: Eva Rifa Date: Wed, 15 Mar 2023 11:56:17 +0100 Subject: [PATCH 2/2] Add line breaks in documentation --- R/CST_Anomaly.R | 6 ++++-- man/CST_Anomaly.Rd | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/R/CST_Anomaly.R b/R/CST_Anomaly.R index 2437b5c6..c9326741 100644 --- a/R/CST_Anomaly.R +++ b/R/CST_Anomaly.R @@ -1,4 +1,5 @@ -#'Anomalies relative to a climatology along selected dimension with or without cross-validation +#'Anomalies relative to a climatology along selected dimension with or without +#'cross-validation #' #'@author Perez-Zanon Nuria, \email{nuria.perez@bsc.es} #'@author Pena Jesus, \email{jesus.pena@bsc.es} @@ -55,7 +56,8 @@ #' #'anom <- CST_Anomaly(exp = exp, obs = obs, cross = FALSE, memb = TRUE) #' -#'@seealso \code{\link[s2dv]{Ano_CrossValid}}, \code{\link[s2dv]{Clim}} and \code{\link{CST_Load}} +#'@seealso \code{\link[s2dv]{Ano_CrossValid}}, \code{\link[s2dv]{Clim}} and +#'\code{\link{CST_Load}} #' #'@import multiApply #'@importFrom s2dv InsertDim Clim Ano_CrossValid Reorder diff --git a/man/CST_Anomaly.Rd b/man/CST_Anomaly.Rd index 5ad20a47..5a2784e1 100644 --- a/man/CST_Anomaly.Rd +++ b/man/CST_Anomaly.Rd @@ -2,7 +2,8 @@ % Please edit documentation in R/CST_Anomaly.R \name{CST_Anomaly} \alias{CST_Anomaly} -\title{Anomalies relative to a climatology along selected dimension with or without cross-validation} +\title{Anomalies relative to a climatology along selected dimension with or without +cross-validation} \usage{ CST_Anomaly( exp = NULL, @@ -84,7 +85,8 @@ anom <- CST_Anomaly(exp = exp, obs = obs, cross = FALSE, memb = TRUE) } \seealso{ -\code{\link[s2dv]{Ano_CrossValid}}, \code{\link[s2dv]{Clim}} and \code{\link{CST_Load}} +\code{\link[s2dv]{Ano_CrossValid}}, \code{\link[s2dv]{Clim}} and +\code{\link{CST_Load}} } \author{ Perez-Zanon Nuria, \email{nuria.perez@bsc.es} -- GitLab