diff --git a/DESCRIPTION b/DESCRIPTION index 4483efe45e734ac12ee61608d0f10aef9001ef16..58626d6f3ec36eb185389964255151a8814b9ec7 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.6.9.2 +Version: 1.6.9.3 Date: 2021-01-08 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 3f943f8173491615c333cb169957dbe060d18c10..f8114bdfa1dee5aeb06ca0fccec6d60b92c79a12 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,7 @@ -### 1.6.9.2 Release Notes (2021-01-08) +### 1.6.9.3 Release Notes (2021-01-08) #### New features diff --git a/R/Utils.R b/R/Utils.R index b30a9e088052b8243b4722332c1b59c9b5665caf..adf2d57068faaebb17a81a7657964af891355cfb 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -109,7 +109,16 @@ if (!inherits(x, "InputsModel")) { stop("'x' must be of class 'InputsModel'") } - .ExtractInputsModel(x, i) + if (is.factor(i)) { + i <- as.character(i) + } + if (is.numeric(i)) { + res <- .ExtractInputsModel(x, i) + } else { + res <- lapply(i, function(name) x[[name, exact = TRUE]]) + names(res) <- i + } + return(res) } @@ -148,5 +157,14 @@ if (!inherits(x, "OutputsModel")) { stop("'x' must be of class 'OutputsModel'") } - .ExtractOutputsModel(x, i) + if (is.factor(i)) { + i <- as.character(i) + } + if (is.numeric(i)) { + res <- .ExtractOutputsModel(x, i) + } else { + res <- lapply(i, function(name) x[[name, exact = TRUE]]) + names(res) <- i + } + return(res) }