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.

83 lines
2.1KB

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