make_mean_median_mode_table_by_group: Create a table showing the mean, median, and mode of a...

View source: R/tables.R

make_mean_median_mode_table_by_groupR Documentation

Create a table showing the mean, median, and mode of a certain column

Description

Create a table showing the mean, median, and mode of a certain column

Usage

make_mean_median_mode_table_by_group(
  data,
  group_column,
  data_column,
  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

data_column

A string for the variable you want to get the mean, median, and mode from, Variable should be numeric.

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 the mean, one column for the median, and one column for the mode.

Examples

make_mean_median_mode_table_by_group(mtcars, "gear", "mpg")

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