get_custom_summary_stats: Compute Custom Summary Statistics for One or More Variables

View source: R/summarize.R

get_custom_summary_statsR Documentation

Compute Custom Summary Statistics for One or More Variables

Description

The get_custom_summary_stats() function computes a set of summary statistics (e.g., count, mean, standard deviation, interquartile range, median, skewness, and kurtosis) for one or more variables in a given data frame. Users can optionally specify which statistics to display.

Usage

get_custom_summary_stats(df, ..., show = NULL)

Arguments

df

A data.frame or tibble. The input dataset.

...

One or more variable names (unquoted or quoted) for which the summary statistics will be computed.

show

A character vector specifying which summary statistics to include in the output. Possible values are "n", "mean", "median", "mode", "sd", "iqr", "skewness", and "kurtosis". If NULL (default), all statistics are included.

Details

This function uses dplyr::across() to apply multiple summary functions dynamically to the specified variables. Summary statistics are computed using base R and the moments package for skewness and kurtosis. The resulting summary statistics are named dynamically as ⁠<variable>_<statistic>⁠.

Value

A tibble containing the computed summary statistics. Each statistic is presented as a column with names formatted as ⁠<variable>_<statistic>⁠.

Examples


get_custom_summary_stats(iris, Sepal.Length, show = c("mean", "sd"))


Lightbridge-KS/lbx documentation built on Dec. 4, 2024, 2:53 a.m.