Skip to content
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

NA values break gt_plt_conf_int() #52

Closed
jmbarbone opened this issue Jun 8, 2022 · 1 comment
Closed

NA values break gt_plt_conf_int() #52

jmbarbone opened this issue Jun 8, 2022 · 1 comment

Comments

@jmbarbone
Copy link

Using the example from ?gt_plt_conf_int with NA values added.

library(gtExtras)
packageVersion("gtExtras")
#> [1] '0.4.0'

dplyr::tibble(
  mean = c(12, 10, NA), 
  ci1 = c(8, 5, NA),
  ci2 = c(16, 15, NA),
  ci_plot = c(12, 10, NA)
) %>%
  gt::gt() %>%
  gt_plt_conf_int(
    ci_plot,
    c(ci1, ci2),
    palette = c("red", "lightgrey", "black", "red")
  )
#> Error in if (zero_range(range)) zero_width else diff(range): missing value where TRUE/FALSE needed

# might need to wrap with !isFALSE
scales::zero_range(range(NA))
#> [1] NA

Created on 2022-06-08 by the reprex package (v2.0.1)

@jthomasmock
Copy link
Owner

Thanks for report/reprex @jmbarbone !

I would recommend omitting NA values (ie na.omit()) for now but I have a fix in local dev version and am doing more testing.

The function has a min/max call and adding na.rm=TRUE solves for this problem.

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

No branches or pull requests

2 participants