Learn R Programming

aelab (version 1.1.0)

descriptive_statistic: descriptive_statistic

Description

Compute grouped mean ± SD and min–max summary statistics for one or more numeric variables.

Usage

descriptive_statistic(data, vars, groups, digits = 2)

Value

A tibble with one row per group and two summary columns per variable (`<var>_mean_sd` and `<var>_min_max`).

Arguments

data

A data frame.

vars

<[`tidy-select`][dplyr::dplyr_tidy_select]> Columns to summarise.

groups

<[`tidy-select`][dplyr::dplyr_tidy_select]> Grouping columns.

digits

Number of decimal places to round to. Default is 2.

Examples

Run this code
df <- data.frame(group = c("A","A","B","B"), value = c(1.1, 2.3, 3.5, 4.7))
descriptive_statistic(df, vars = value, groups = group)

Run the code above in your browser using DataLab