Closed DanielEWeeks closed 1 year ago
Howdy @DanielEWeeks - thanks for reporting. My kingdom for no NAs 😢
I have a local fix and will push to GH shortly. Using your reprex as-is, here's it working locally.
library(dplyr)
library(gt)
library(gtExtras)
packageVersion("gtExtras")
#> [1] '0.5.0.9000'
df <- tibble(trait=c("age","weight","time"),
Distribution=c(list(rnorm(50),NA, runif(50, min=5, max=10))))
# This runs without an error
df %>% gt() %>% gt_plt_dist(Distribution, same_limit = TRUE) |> gt_reprex_image()
# This stops with an error
df %>% gt() %>% gt_plt_dist(Distribution, same_limit = FALSE) |> gt_reprex_image()
Created on 2023-10-03 by the reprex package (v2.0.1)
Wonderful! Thank you for fixing so fast.
I'm really excited about adding spark plots to our descriptive tables!
Prework
Description
Part I: Setting
same_limit
toFALSE
works as expected whentype="histogram"
, but appears to have no effect whentype="density"
Part II: If the set of lists being sent to
gt_plt_dist
contains an empty list, then this works as expected whensame_limit
isTRUE
but dies in an error whensame_limit
isFALSE
.Reproducible example
Part I
Part II
The last line of code above generates this error:
Expected result
Part I: Setting
same_limit
toFALSE
should shift the scales of the densities to have similar visual limits whentype="density"
Part II: Setting
same_limit
toFALSE
should not generate an error when some of the lists of values are NA.The reason I have some rows with empty value lists is I am trying to insert spark plots into a table initially created by the
table1
R command - it put the trait name in an empty row by itself, followed by summary statistics on the next line.Session info