knitr::opts_chunk$set(message = F, warning = F)
Warning to existing users
This version introduces a new API that should make the creation of tables more flexible.
The old API is still present but in a deprecated mode.
See the roadmap below, and the website for the new usage.
Suggestions about this change are welcome !
Desctable aims to be a simple and expressive interface to building statistical tables in R.
Install from CRAN with
install.packages("desctable")
or install the development version from github with
devtools::install_github("desctable/desctable")
Load the package
library(desctable)
Simply apply desc_table
on a dataframe or a grouped dataframe to get a statistical table
iris %>% desc_table()
Declare the statistics you want to see, and give them the name of your choice
iris %>% desc_table("N" = length, "%" = percent, mean, sd)
Create comparative tables, compute statistical tests and output to pander
for crisp markdown rendering!
mtcars %>% dplyr::mutate(cyl = factor(cyl), vs = factor(vs, labels = c("V-shaped", "straight")), am = factor(am, labels = c("automatic", "manual"))) %>% group_by(am) %>% desc_table(N = length, "%" = percent, "Median" = median, IQR) %>% desc_tests(vs = ~chisq.test) %>% desc_output("pander")
Read more in the vignette !
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.