Commit 82e1cd7d authored by Delaigue Olivier's avatar Delaigue Olivier Committed by Dorchies David
Browse files

v1.4.4.15 CLEAN: ConvertFun checked simplified in SeriesAggreg2

Showing with 6 additions and 10 deletions
+6 -10
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")),
......
......@@ -4,7 +4,7 @@
### 1.4.4.14 Release Notes (2020-04-09)
### 1.4.4.15 Release Notes (2020-04-09)
#### New features
......
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment