make_mean_std_dev_by_group_table: Get mean and standard deviation of variables by group

View source: R/tables.R

make_mean_std_dev_by_group_tableR Documentation

Get mean and standard deviation of variables by group

Description

Get mean and standard deviation of variables by group

Usage

make_mean_std_dev_by_group_table(data, group_column, columns, total_row = TRUE)

Arguments

data

A data.frame with the data you want to make the table from.

group_column

A string with the name of the variable you are grouping by

columns

A string or vector of strings for the variables you want to get the mean and standard deviation for.

total_row

A boolean (default TRUE) for whether to include a row a the bottom for the overall mean and standard deviation (i.e. not by group).

Value

A data.frame with the first column showing the category grouped by. Then one column for each variable you want the mean and standard deviation for. Will give the mean and standard deviation as a single string with the standard deviation in parentheses.

Examples

make_mean_std_dev_by_group_table(mtcars, "gear", c("mpg", "disp"))

jacobkap/crimeutils documentation built on Jan. 1, 2023, 12:20 a.m.