summary_by_group: Summary Statistics of Numerical Variable by Group

Description Usage Arguments Value Examples

Description

Get the summary statistics (max, min, mean and median) of a numerical variable across the groups of a categorical variable.

Usage

1
summary_by_group(numeric_vector, group_vector)

Arguments

numeric_vector

An vector of class "numeric", each numerical value is a part of one observation row. To make the name of parameter be more specific, I named it as "numeric_vector".

group_vector

An vector which represents the group type of each numeric value in the "numeric_vector" one by one. To emphasize the group type, I named it as "group_vector".

Value

An object of class "data.frame" that contains the summary statistics of each group type.

Examples

1
2
summary_by_group(c(1.5, 7.6, 3.0, 4.7, 8, 8.4), c("A", "C", "A", "B", "B", "A"))
summary_by_group(datateachr::vancouver_trees$diameter, datateachr::vancouver_trees$genus_name)

stat545ubc-2021/functions-SylvieShen documentation built on Dec. 23, 2021, 5:25 a.m.