You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inconsistent treatment of na.rm = TRUE in geom_pointrange #5261
I've noticed a minor inconsistency in the treatment of na.rm=TRUE in geom_pointrange.
When all values of ymin and ymax are missing for a group, geom_pointrange(..., na.rm =TRUE) will issue a warning message.
I expected that the behaviour of geom_pointrange would be the same as geom_linerange, geom_crossbar and geom_errorbar (which currently don't issue a warning).
library(ggplot2)
# Based on example from docsdf<-data.frame(
trt=factor(c(1, 1, 2, 2)),
resp= c(1, 5, 3, 4),
group=factor(c(1, 2, 1, 2)),
upper= c(1.1, NA_real_, 3.3, NA_real_),
lower= c(0.8, NA_real_, 2.4, NA_real_)
)
p<- ggplot(df, aes(trt, resp, colour=group))
# Point range complains where one colour has all missing valuesp+ geom_pointrange(aes(ymin=lower, ymax=upper), na.rm=TRUE)
#> Warning: Removed 2 rows containing missing values (`geom_segment()`).
# Rest of the family are all good thisp+ geom_linerange(aes(ymin=lower, ymax=upper), na.rm=TRUE)
Activity