diff options
| author | Johannes Ranke <jranke@uni-bremen.de> | 2014-11-23 16:24:14 +0100 | 
|---|---|---|
| committer | Johannes Ranke <jranke@uni-bremen.de> | 2014-11-23 16:24:14 +0100 | 
| commit | c97a47bcce5455478a18dcdcd71f4a2f2344bce0 (patch) | |
| tree | 97d2a9b15fc273b3d7fedb10671e43d2b968804c | |
| parent | 10100d5ad4fd25abee99843829481c662c93edcc (diff) | |
Avoid spurious warning in mkinparplot, bump version
| -rw-r--r-- | DESCRIPTION | 4 | ||||
| -rw-r--r-- | NEWS.md | 6 | ||||
| -rw-r--r-- | 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"), @@ -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)  | 
