-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Description
When using forestplot() (version 3.1.7), the function behaves inconsistently when estimates are negative.
Specifically:
- When coefficients are made negative but CIs remain positive, the box is not drawn (only CI lines appear).
- When both coefficients and CIs are negative, the function throws an internal error:
Warning in min(cwidth[cwidth > 0], na.rm = TRUE):
no non-missing arguments to min; returning Inf
Error in if (any(textHeight * (nrow(estimates) + 0.5) * 1.5 < boxsize)) :
missing value where TRUE/FALSE neededpackageVersion("forestplot")
#> [1] '3.1.7'
library(forestplot)
#> Loading required package: grid
#> Loading required package: checkmate
#> Loading required package: abind
# A basic example, create some fake data
row_names <- list(list("test = 1", expression(test >= 2)))
test_data <- data.frame(
coef = c(1.59, 1.24),
low = c(1.4, 0.78),
high = c(1.8, 1.55)
)
forestplot(test_data,
labeltext = row_names,
mean = coef,
lower = low,
upper = high)# Make coefficient negative
test_data$coef <- test_data$coef * -1
forestplot(test_data,
labeltext = row_names,
mean = coef,
lower = low,
upper = high)# Make CI negative
test_data$low <- test_data$low * -1
test_data$high <- test_data$high * -1
forestplot(test_data,
labeltext = row_names,
mean = coef,
lower = low,
upper = high)#> Warning in min(cwidth[cwidth > 0], na.rm = TRUE): no non-missing arguments to
#> min; returning Inf
#> Error in `if (any(textHeight * (nrow(estimates) + 0.5) * 1.5 < boxsize)) ...`:
#> ! missing value where TRUE/FALSE needed
Created on 2026-02-24 with reprex v2.1.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels


