From c97a47bcce5455478a18dcdcd71f4a2f2344bce0 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sun, 23 Nov 2014 16:24:14 +0100 Subject: Avoid spurious warning in mkinparplot, bump version --- DESCRIPTION | 4 ++-- NEWS.md | 6 ++++++ R/mkinparplot.R | 14 ++++++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index aa382e66..202251fb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,8 @@ Package: mkin Type: Package Title: Routines for Fitting Kinetic Models with One or More State Variables to Chemical Degradation Data -Version: 0.9-34 -Date: 2014-11-21 +Version: 0.9-35 +Date: 2014-11-22 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 5d51c6ed..fdd25051 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# CHANGES in mkin VERSION 0.9-35 + +## BUG FIXES + +- `mkinparplot()`: Avoid warnings that occurred when not all confidence intervals were available in the summary of the fit + # CHANGES in mkin VERSION 0.9-34 ## NEW FEATURES diff --git a/R/mkinparplot.R b/R/mkinparplot.R index 4abecab9..b2debe9d 100644 --- a/R/mkinparplot.R +++ b/R/mkinparplot.R @@ -39,6 +39,8 @@ mkinparplot <- function(object) { for (type in names(n.plot)) { parnames <- get(type) values <- bpar[parnames] + values_with_confints <- data.frame(t(subset(data.frame(t(values)), !is.na(Lower)))) + parnames_with_confints <- names(values_with_confints) xlim = switch(type, state.optim = range(c(0, unlist(values)), na.rm = TRUE, finite = TRUE), @@ -48,7 +50,10 @@ mkinparplot <- function(object) { na.rm = TRUE, finite = TRUE), fractions.optim = range(c(0, 1, unlist(values)), na.rm = TRUE, finite = TRUE)) - stripchart(values["Estimate", ][length(parnames):1], + parname_index <- length(parnames):1 # Reverse order for strip chart + names(parname_index) <- parnames + parnames_with_confints_index <- parname_index[parnames_with_confints] + stripchart(values["Estimate", ][parname_index], xlim = xlim, ylim = c(0.5, length(get(type)) + 0.5), yaxt = "n") @@ -58,9 +63,10 @@ mkinparplot <- function(object) { text(ifelse(position == "left", min(xlim), max(xlim)), length(parnames):1, parnames, pos = ifelse(position == "left", 4, 2)) - values.upper.nonInf <- ifelse(values["Upper", ] == Inf, 1.5 * xlim[[2]], values["Upper", ]) - arrows(as.numeric(values["Lower", ]), length(parnames):1, - as.numeric(values.upper.nonInf), length(parnames):1, + + values_with_confints.upper.nonInf <- ifelse(values_with_confints["Upper", ] == Inf, 1.5 * xlim[[2]], values_with_confints["Upper", ]) + arrows(as.numeric(values_with_confints["Lower", ]), parnames_with_confints_index, + as.numeric(values_with_confints.upper.nonInf), parnames_with_confints_index, code = 3, angle = 90, length = 0.05) } par(oldpars) -- cgit v1.2.1