tidy_quantile: Generate tidy quantiles for a dataframe column

View source: R/tidy-stats.R

tidy_quantileR Documentation

Generate tidy quantiles for a dataframe column

Description

This function respects groupings from dplyr::group_by(). When the dataframe contains grouped data, the quantiles are computed within each subgroup of data.

Usage

tidy_quantile(data, var, probs = seq(0.1, 0.9, 0.2))

Arguments

data

a dataframe

var

a column in the dataframe

probs

quantiles to return. Defaults to c(.1, .3, .5, .7, .9)

Value

a long dataframe (a tibble) with quantiles for the variable.

Examples

tidy_quantile(sleep, extra)

sleep %>%
  dplyr::group_by(group) %>%
  tidy_quantile(extra)

tjmahr/tjmisc documentation built on Feb. 8, 2023, 12:21 p.m.