You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.0KB

  1. ---
  2. title: "Desctable"
  3. output: github_document
  4. ---
  5. ```{r, echo = F, message = F, warning = F}
  6. knitr::opts_chunk$set(message = F, warning = F)
  7. ```
  8. [![Travis-CI Build Status](https://travis-ci.org/desctable/desctable.svg?branch=master)](https://travis-ci.org/desctable/desctable) [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/desctable)](https://cran.r-project.org/package=desctable) [![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/desctable)](https://www.r-pkg.org:443/pkg/desctable)
  9. **Warning to existing users**
  10. *This version introduces a new API that should make the creation of tables more flexible.
  11. The old API is still present but in a deprecated mode.
  12. See the roadmap below, and the website for the new usage.
  13. Suggestions about this change are welcome !*
  14. ---
  15. # Introduction
  16. Desctable aims to be a simple and expressive interface to building statistical tables in R.
  17. # Installation
  18. Install from CRAN with
  19. ```
  20. install.packages("desctable")
  21. ```
  22. or install the development version from github with
  23. ```
  24. devtools::install_github("desctable/desctable")
  25. ```
  26. # Basic usage
  27. Load the package
  28. ```{r}
  29. library(desctable)
  30. ```
  31. Simply apply `desc_table` on a dataframe or a grouped dataframe to get a statistical table
  32. ```{r}
  33. iris %>%
  34. desc_table()
  35. ```
  36. Declare the statistics you want to see, and give them the name of your choice
  37. ```{r}
  38. iris %>%
  39. desc_table("N" = length,
  40. "%" = percent,
  41. mean,
  42. sd)
  43. ```
  44. Create comparative tables, compute statistical tests and output to `pander` for crisp markdown rendering!
  45. ```{r}
  46. mtcars %>%
  47. dplyr::mutate(cyl = factor(cyl),
  48. vs = factor(vs, labels = c("V-shaped", "straight")),
  49. am = factor(am, labels = c("automatic", "manual"))) %>%
  50. group_by(am) %>%
  51. desc_table(N = length,
  52. "%" = percent,
  53. "Median" = median,
  54. IQR) %>%
  55. desc_tests(vs = ~chisq.test) %>%
  56. desc_output("pander")
  57. ```
  58. Read more in the [vignette](articles/desctable.html) !