# NOT RUN {
iris %>%
desctable()
# Does the same as stats_auto here
iris %>%
desctable(stats = list("N" = length,
"Mean" = ~ if (is.normal(.)) mean(.),
"sd" = ~ if (is.normal(.)) sd(.),
"Med" = stats::median,
"IQR" = ~ if(!is.factor(.)) IQR(.)))
# With labels
mtcars %>% desctable(labels = c(hp = "Horse Power",
cyl = "Cylinders",
mpg = "Miles per gallon"))
# With grouping on a factor
iris %>%
group_by(Species) %>%
desctable(stats = stats_default)
# With nested grouping, on arbitrary variables
mtcars %>%
group_by(vs, cyl) %>%
desctable()
# With grouping on a condition, and choice of tests
iris %>%
group_by(Petal.Length > 5) %>%
desctable(tests = list(.auto = tests_auto, Species = ~chisq.test))
# }
Run the code above in your browser using DataLab