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 --- R/mkinparplot.R | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'R') 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