aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2015-12-09 16:15:05 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2015-12-09 16:15:05 +0100
commit652f58915d56aa225fc01bff007f19f3277eed9f (patch)
tree4ce6cd1a3edd08b15e9b260ec1a2d2c14635bc68
parent556598ba543cf655cdc0a6995cc579327f9540ad (diff)
Improve mkinmod error message for missing target compartment definition
Closes #6.
-rw-r--r--NEWS.md2
-rw-r--r--R/mkinmod.R1
2 files changed, 3 insertions, 0 deletions
diff --git a/NEWS.md b/NEWS.md
index 68d5a394..8e6ed11f 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -6,6 +6,8 @@
- Add plots to `compiled_models` vignette
+- Give an explanatory error message when mkinmod fails due to a missing definition of a target variable
+
## mkin 0.9-41 (2015-11-09)
### Minor changes
diff --git a/R/mkinmod.R b/R/mkinmod.R
index f98a3803..c70f1260 100644
--- a/R/mkinmod.R
+++ b/R/mkinmod.R
@@ -180,6 +180,7 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL, quiet = FALSE, verb
# Add transfer terms to listed compartments
for (target in to) {
+ if (!target %in% obs_vars) stop("You did not specify a submodel for target variable ", target)
target_box <- switch(spec[[target]]$type,
SFO = target,
IORE = target,

Contact - Imprint