Commit 49181abb authored by Delaigue Olivier's avatar Delaigue Olivier

v1.4.3.79 CLEAN: multiple "if" conditions to select the TimeFormat in...

v1.4.3.79 CLEAN: multiple "if" conditions to select the TimeFormat in SeriesAggreg replaced by the use of the switch function
parent 3f60ee8c
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.4.3.78
Version: 1.4.3.79
Date: 2020-04-06
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -4,7 +4,7 @@
### 1.4.3.78 Release Notes (2020-04-06)
### 1.4.3.79 Release Notes (2020-04-06)
#### CRAN-compatibility updates
......
......@@ -69,18 +69,11 @@ SeriesAggreg <- function(TabSeries,
stop("'YearFirstMonth' must be only one integer between 1 and 12")
}
##check_DatesR_integrity
if (TimeFormat == "hourly") {
by <- "hours"
}
if (TimeFormat == "daily") {
by <- "days"
}
if (TimeFormat == "monthly") {
by <- "months"
}
if (TimeFormat == "yearly") {
by <- "years"
}
by <- switch(TimeFormat,
'hourly' = "hours",
'daily' = "days",
'monthly' = "months",
'yearly' = "years")
TmpDatesR <- seq(from = TabSeries[1, 1], to = tail(TabSeries[, 1], 1), by = by)
if (!identical(TabSeries[, 1], TmpDatesR)) {
stop("some dates might not be ordered or are missing in 'TabSeries'")
......
Markdown is supported
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