diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-12-07 10:49:31 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-12-07 10:49:31 +0100 |
commit | d3531ffa0d1f190920174105facf799dd6c3a851 (patch) | |
tree | 039078d52cfbe63107799e9e6c54dfe3c6aa0ca7 | |
parent | bde136db0a42fad5e128f40d8298bd9a35b96491 (diff) |
Attempt to be more failsafe in saemix runs
-rw-r--r-- | R/mkinpredict.R | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/R/mkinpredict.R b/R/mkinpredict.R index 277c3604..4b618490 100644 --- a/R/mkinpredict.R +++ b/R/mkinpredict.R @@ -222,11 +222,17 @@ mkinpredict.mkinmod <- function(x, if (map_output) { # Output transformation for models with unobserved compartments like SFORB # if not already mapped in analytical solution + if (!na_stop) { + available <- c(TRUE, rep(FALSE, length(outtimes) - 1)) + } else { + available <- rep(TRUE, length(outtimes)) + } for (var in names(x$map)) { if((length(x$map[[var]]) == 1)) { - out_obs[, var] <- out[, var] + out_obs[available, var] <- out[available, var] } else { - out_obs[, var] <- out[, x$map[[var]][1]] + out[, x$map[[var]][2]] + out_obs[available, var] <- out[available, x$map[[var]][1]] + + out[available, x$map[[var]][2]] } } return(out_obs) |