diff --git a/DESCRIPTION b/DESCRIPTION index 5ab57cb951bff4f61efa734e9855f6d83d66f75c..02d20cc45813594d00e99efbfc4b13608aa7e1c2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: airGR Type: Package Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling -Version: 1.4.4.14 +Version: 1.4.4.15 Date: 2020-04-09 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")), diff --git a/NEWS.md b/NEWS.md index d7a4baa116b1a73d2e60064c28dad9d6bfbf864d..83d0ca96bbba8e80f0aa130b2c8bd7b8d00e6c8c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,7 +4,7 @@ -### 1.4.4.14 Release Notes (2020-04-09) +### 1.4.4.15 Release Notes (2020-04-09) #### New features diff --git a/R/SeriesAggreg2.R b/R/SeriesAggreg2.R index befb899c6536f65e602c34665dca5c81fabcbbb4..6fbbffe6840fb3fde0cecdf285b0878ce075212b 100644 --- a/R/SeriesAggreg2.R +++ b/R/SeriesAggreg2.R @@ -28,20 +28,16 @@ SeriesAggreg2 <- function(TabSeries, Format, ConvertFun, Format <- gsub(pattern = "[[:punct:]]+", replacement = "%", Format) Format <- match.arg(Format, choices = listFormat) ## check ConvertFun - if (!is.vector(ConvertFun)) { - stop("'ConvertFun' must be a vector of character") - } - if (!is.character(ConvertFun)) { - stop("'ConvertFun' must be a vector of character") + listConvertFun <- c("sum", "mean") + ConvertFun <- listConvertFun[match(ConvertFun, listConvertFun)] + if (anyNA(ConvertFun)) { + stop("'ConvertFun' should be a one of 'sum' or 'mean'") } if (length(ConvertFun) != (ncol(TabSeries) - 1)) { stop( sprintf("'ConvertFun' must be of length %i (ncol(TabSeries)-1)", ncol(TabSeries) - 1) ) } - if (!all(ConvertFun %in% c("sum", "mean"))) { - stop("'ConvertFun' should be one of 'sum' or 'mean'") - } ## check YearFirstMonth msgYearFirstMonth <- "'YearFirstMonth' should be a numeric value between 1 and 12" YearFirstMonth <- match(YearFirstMonth, 1:12)