make_mean_median_mode_table_by_group {crimeutils}R 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")

[Package crimeutils version 0.5.1 Index]