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
Hi there!
Loving this package, but I wonder if there is any bug when trying to display the missing % for a categorical variable using the add_n() function combined with the by statement:
Hi there!
Loving this package, but I wonder if there is any bug when trying to display the missing % for a categorical variable using the add_n() function combined with the by statement:
data.frame(x = c(1,2,NA, NA, NA, 1, 2, 1),
y = c(rep(0,4), rep(1,4))) %>%
tbl_summary(by = y) %>%
add_n(statistic = "{n_miss}/{N} = {p_miss}%")
In this case we should have 3/8 = 38%, but here it is displaying 75%.
It only happens if we use the by statement, as if works just fine when I use:
data.frame(x = c(1,2,NA, NA, NA, 1, 2, 1),
y = c(rep(0,4), rep(1,4))) %>%
select(x) %>%
tbl_summary() %>%
add_n(statistic = "{n_miss}/{N} = {p_miss}%")
Thanks in advance!
Tamy
The text was updated successfully, but these errors were encountered: