Commit 05cf434b authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.6.9.3 refactor: '['.InputsModel and '['.OutputsModel run like a "classical"...

v1.6.9.3 refactor: '['.InputsModel and '['.OutputsModel run like a "classical" call of the '[' if the index is a charcater
Refs #67
Showing with 22 additions and 4 deletions
+22 -4
Package: airGR Package: airGR
Type: Package Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.6.9.2 Version: 1.6.9.3
Date: 2021-01-08 Date: 2021-01-08
Authors@R: c( Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")), person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
### 1.6.9.2 Release Notes (2021-01-08) ### 1.6.9.3 Release Notes (2021-01-08)
#### New features #### New features
......
...@@ -109,7 +109,16 @@ ...@@ -109,7 +109,16 @@
if (!inherits(x, "InputsModel")) { if (!inherits(x, "InputsModel")) {
stop("'x' must be of class '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 @@ ...@@ -148,5 +157,14 @@
if (!inherits(x, "OutputsModel")) { if (!inherits(x, "OutputsModel")) {
stop("'x' must be of class '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)
} }
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