-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
86 lines (66 loc) · 1.93 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# meantables <img style="padding: 15px;" align="left" src="man/figures/meantables_hex/meantables.png" alt="meantables hex logo" width="250" height="289">
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/meantables)](https://cran.r-project.org/package=meantables)
[![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/meantables)](https://www.r-pkg.org/pkg/meantables)
<!-- badges: end -->
The goal of meantables is to quickly make tables of descriptive statistics (i.e., counts, means, confidence intervals) for continuous variables. This package is designed to work in a Tidyverse pipeline, and consideration has been given to get results from R to 'Microsoft Word' ® with minimal pain.
## Installation
You can install the released version of meantables from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("meantables")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("brad-cannell/meantables")
```
## Example
```{r}
library(dplyr)
library(meantables)
```
```{r}
data("mtcars")
```
### Overall mean table with defaults
```{r}
mtcars %>%
mean_table(mpg)
```
### Formatting overall mean and 95% CI
```{r}
mtcars %>%
mean_table(mpg) %>%
mean_format(
recipe = "mean (lcl - ucl)",
name = "mean_95",
digits = 1
) %>%
select(response_var, mean_95)
```
### Formatting grouped means table with mean and sd
```{r}
mtcars %>%
group_by(cyl) %>%
mean_table(mpg) %>%
mean_format("mean (sd)") %>%
select(response_var:group_cat, formatted_stats)
```
### Grouped means table with defaults
```{r}
mtcars %>%
group_by(cyl) %>%
mean_table(mpg)
```