data(efc)
# vector/factor
data_tabulate(efc$c172code)
# data frame
data_tabulate(efc, c("e42dep", "c172code"))
# grouped data frame
if (requireNamespace("poorman")) {
suppressPackageStartupMessages(library(poorman, quietly = TRUE))
efc %>%
group_by(c172code) %>%
data_tabulate("e16sex")
# collapse tables
efc %>%
group_by(c172code) %>%
data_tabulate("e16sex", collapse = TRUE)
}
# for larger N's (> 100000), a big mark is automatically added
set.seed(123)
x <- sample(1:3, 1e6, TRUE)
data_tabulate(x, name = "Large Number")
# to remove the big mark, use "print(..., big_mark = "")"
print(data_tabulate(x), big_mark = "")
Run the code above in your browser using DataLab