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

v1.4.4.28 fix: SeriesAggreg2 now runs when there is only 1 variable in the...

v1.4.4.28 fix: SeriesAggreg2 now runs when there is only 1 variable in the input and ConvertFun = mean #41
parent 7538d88e
Package: airGR
Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.4.4.27
Version: 1.4.4.28
Date: 2020-04-30
Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
......@@ -4,7 +4,7 @@
### 1.4.4.27 Release Notes (2020-04-30)
### 1.4.4.28 Release Notes (2020-04-30)
#### New features
......
......@@ -141,13 +141,14 @@ SeriesAggreg2.data.frame <- function(TabSeries, Format, TimeFormat, NewTimeForma
tsAggregMean <- data.frame(a = NA, b = NA)
}
if ("sum" %in% ConvertFun) {
colTsAggregSum <- c("Fac2", colnames(TabSeries)[-1L][ConvertFun == "sum" ])
tsAggregSum <- aggregate(. ~ Fac2, data = TabSeries2[, colTsAggregSum ], FUN = sum, na.action = na.pass)
colTsAggregSum <- c("Fac2", colnames(TabSeries)[-1L][ConvertFun == "sum"])
tsAggregSum <- aggregate(. ~ Fac2, data = TabSeries2[, colTsAggregSum], FUN = sum, na.action = na.pass)
} else {
tsAggregSum <- data.frame(a = NA, b = NA)
}
tsAggreg <- cbind(tsAggregMean[, -1, drop = FALSE], tsAggregSum)
tsAggreg <- cbind(tsAggregMean, tsAggregSum)
tsAggreg <- tsAggreg[, !duplicated(colnames(tsAggreg))]
tsAggreg <- merge(tsAggreg, TabSeries2[, c("Fac2", "DatesR", "DatesRini", "Selec")], by = "Fac2", all.x = TRUE, all.y = FALSE)
tsAggreg <- tsAggreg[tsAggreg$Selec & tsAggreg$DatesRini, ]
tsAggreg <- tsAggreg[, colnames(TabSeries0)]
......
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