dplyr_bundle: A bundle of dplyr functions

Description Usage Arguments Value Examples

View source: R/Function.R

Description

This function calculates the summary statistics such as mean and range for a numerical variable grouped by a categorical variable (both of which are your choice) from an input dataset. It uses the dplyr functions group_by and summarise to output a tibble or data frame depending on your input data type class.

Usage

1

Arguments

input

A dataframe or tibble input.

group

A categorical column in the dataframe/tibble that should be used for grouping.

summary

A numerical column for which summary statistics are to be computed.

Value

A Tibble containing four columns- categorical variable by which the data is grouped, mean, minimum, maximum computed for a numerical variable.

Examples

1
2
dplyr_bundle(datateachr::vancouver_trees, group = common_name, summary = diameter)
dplyr_bundle(palmerpenguins::penguins, group = island, summary = flipper_length_mm)

stat545ubc-2021/packageAditi documentation built on Dec. 23, 2021, 5:26 a.m.