From fe16512e7f9e875340d498b01920e5967a2b7bd0 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sat, 10 Sep 2016 03:13:33 +0200 Subject: Plot using R model if compiled model is not available --- DESCRIPTION | 4 ++-- NEWS.md | 6 ++++++ R/plot.mkinfit.R | 11 +++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ef30256e..db72a3bd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: mkin Type: Package Title: Kinetic Evaluation of Chemical Degradation Data -Version: 0.9.44 -Date: 2016-06-28 +Version: 0.9.44.9000 +Date: 2016-07-27 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), email = "jranke@uni-bremen.de"), person("Katrin", "Lindenberger", role = "ctb"), diff --git a/NEWS.md b/NEWS.md index 8d7a55de..fd079897 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,11 @@ # NEWS for package 'mkin' +## mkin 0.9.45 + +### Minor changes + +- `plot.mkinfit`: Plotting does not fail any more when the compiled model is not available, e.g. because it was removed from the temporary directory. In this case, the uncompiled model is now used for plotting + ## mkin 0.9.44 (2016-06-29) ### Bug fixes diff --git a/R/plot.mkinfit.R b/R/plot.mkinfit.R index 303effb5..00598737 100644 --- a/R/plot.mkinfit.R +++ b/R/plot.mkinfit.R @@ -53,8 +53,15 @@ plot.mkinfit <- function(x, fit = x, rownames(subset(fit$fixed, type == "deparm"))) odeparms <- parms.all[odenames] - out <- mkinpredict(fit$mkinmod, odeparms, odeini, outtimes, - solution_type = solution_type, atol = fit$atol, rtol = fit$rtol) + out <- try(mkinpredict(fit$mkinmod, odeparms, odeini, outtimes, + solution_type = solution_type, atol = fit$atol, rtol = fit$rtol), + silent = TRUE) + + if (inherits(out, "try-error")) { + out <- mkinpredict(fit$mkinmod, odeparms, odeini, outtimes, + solution_type = solution_type, atol = fit$atol, rtol = fit$rtol, + use_compiled = FALSE) + } names(col_obs) <- names(pch_obs) <- names(lty_obs) <- obs_vars -- cgit v1.2.1