I'm trying to use tbl_summary
from gtsummary
package to build my descriptive statistics table with both continuous and categorical variables. However, for categorical variables, the percentages do not sum up to 100. Any suggestion on how to solve the issue?
You can see what I mean by running the code below and looking at the variables gear
and carb
:
data(mtcars)
library(gtsummary)
tbl <- tbl_summary(mtcars)
tbl
You are having a rounding problem:
data(mtcars)
library(gtsummary)
tbl <- tbl_summary(mtcars, digits = list(all_categorical() ~ c(0, 3)))
tbl
That code and its variants should work