summarize_data: Compute summary statistics, produce a tibble or data frame...

Description Usage Arguments Value References Examples

View source: R/summarize_data.R

Description

This function computes summary statistics on a numeric variable grouped by a categorical variable. The summary statistics include mean, median, minimum, maximum, and count.

Usage

1
summarize_data(df, x, y, na.rm = TRUE)

Arguments

df

Tibble or data frame containing variables for computing summary statistics. Name is easily recognizable.

x

A categorical variable by which rows are grouped. It is named x because it is more generally used and easy to identify.

y

A numeric variable for computing summary statistics. It is named y because it is more generally used and easy to identify.

na.rm

A logical value that gives the option to either remove or retain missing values. It is a generally used argument to specify whether or not to remove missing values.

Value

A list object with 2 items: a tibble or data frame and a ggplot object- boxplot.

References

Syntax suggested on StackOverflow by Gabra https://stackoverflow.com/questions/40102613/ggplot2-adding-sample-size-information-to-x-axis-tick-labels https://dplyr.tidyverse.org/articles/programming.html

Examples

1
2
summarize_data(gapminder::gapminder, continent, lifeExp)
summarize_data(datateachr::cancer_sample, diagnosis, perimeter_mean)

eamutaigwe/statsummary documentation built on Dec. 20, 2021, 2:22 a.m.