Commit 1ea8ba8c authored by Delaigue Olivier's avatar Delaigue Olivier Committed by Dorchies David
Browse files

v1.4.4.11 NEW: ConvertFun argument now checked in SeriesAggreg2

Showing with 18 additions and 2 deletions
+18 -2
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.4.4.10
Version: 1.4.4.11
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.10 Release Notes (2020-04-09)
### 1.4.4.11 Release Notes (2020-04-09)
#### New features
......
......@@ -27,6 +27,22 @@ SeriesAggreg2 <- function(TabSeries, Format, ConvertFun,
listFormat <- c("%Y%m%d", "%Y%m", "%Y", "%m", "%d")
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")
}
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'")
}
sp <- sprintf("%02.f", YearFirstMonth)
......
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