Skip to content

geom_linerange() issues warning about missing values, irrespective of whether na.rm is set to TRUE or FALSE #4927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
IndrajeetPatil opened this issue Aug 1, 2022 · 0 comments · Fixed by #4928

Comments

@IndrajeetPatil
Copy link

Just like other geom_*() functions, I'd expect this function not to generate a warning when na.rm = TRUE.

library(ggplot2)

df <- data.frame(
  trt = factor(c(1, 1, 2, 2)),
  resp = c(1, 5, NA, 4),
  group = factor(c(1, 1, 1, 2)),
  upper = c(1.1, 5.3, NA, 4.2),
  lower = c(0.8, 4.6, 2.4, NA)
)

p <- ggplot(df, aes(trt, resp, colour = group))

p + geom_linerange(aes(ymin = lower, ymax = upper), na.rm = FALSE)
#> Warning: Removed 2 rows containing missing values (geom_segment).

p + geom_linerange(aes(ymin = lower, ymax = upper), na.rm = TRUE)
#> Warning: Removed 2 rows containing missing values (geom_segment).

Created on 2022-08-01 by the reprex package (v2.0.1.9000)

thomasp85 added a commit that referenced this issue Aug 1, 2022
thomasp85 added a commit that referenced this issue Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant