mean_table | R Documentation |
The mean_table function produces overall and grouped tables of means with related statistics. In addition to means, the mean_table missing/non-missing frequencies, the standard error of the mean (sem), the 95 value, and the maximum value. For grouped tibbles, mean_table displays these statistics for each category of the group_by variable.
mean_table(.data, .x, t_prob = 0.975, output = default, digits = 2, ...)
.data |
A tibble or grouped tibble. |
.x |
The continuous response variable for which the statistics are desired. |
t_prob |
(1 - alpha / 2). Default value is 0.975, which corresponds to an alpha of 0.05. Used to calculate a critical value from Student's t distribution with n - 1 degrees of freedom. |
output |
Options for this parameter are "default" and "all". Default output includes the n, mean, sem, and 95 the mean. Using output = "all" also returns the the number of missing values for .x and the critical t-value. |
digits |
Round mean, lcl, and ucl to digits. Default is 2. |
... |
Other parameters to be passed on. |
A tibble of class "mean_table" or "mean_table_grouped"
SAS documentation: http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p0klmrp4k89pz0n1p72t0clpavyx.htm
## Not run: library(dplyr) library(meantables) data(mtcars) # Overall mean table with defaults mtcars %>% mean_table(mpg) # A tibble: 1 x 9 response_var n mean sd sem lcl ucl min max <chr> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 mpg 32 20.1 6.03 1.07 17.9 22.3 10.4 33.9 # Grouped means table with defaults mtcars %>% group_by(cyl) %>% mean_table(mpg) # A tibble: 3 x 11 response_var group_var group_cat n mean sd sem lcl ucl min max <chr> <chr> <dbl> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 mpg cyl 4 11 26.7 4.51 1.36 23.6 29.7 21.4 33.9 2 mpg cyl 6 7 19.7 1.45 0.549 18.4 21.1 17.8 21.4 3 mpg cyl 8 14 15.1 2.56 0.684 13.6 16.6 10.4 19.2 ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.