pivot_quantiles_wider: Pivot columns containing 'dist_quantile' wider

View source: R/pivot_quantiles.R

pivot_quantiles_widerR Documentation

Pivot columns containing dist_quantile wider

Description

Any selected columns that contain dist_quantiles will be "widened" with the "taus" (quantile) serving as names and the values in the data frame. When pivoting multiple columns, the original column name will be used as a prefix.

Usage

pivot_quantiles_wider(.data, ...)

Arguments

.data

A data frame, or a data frame extension such as a tibble or epi_df.

...

<tidy-select> One or more unquoted expressions separated by commas. Variable names can be used as if they were positions in the data frame, so expressions like x:y can be used to select a range of variables.

Value

An object of the same class as .data

Examples

d1 <- c(dist_quantiles(1:3, 1:3 / 4), dist_quantiles(2:4, 1:3 / 4))
d2 <- c(dist_quantiles(2:4, 2:4 / 5), dist_quantiles(3:5, 2:4 / 5))
tib <- tibble::tibble(g = c("a", "b"), d1 = d1, d2 = d2)

pivot_quantiles_wider(tib, c("d1", "d2"))
pivot_quantiles_wider(tib, dplyr::starts_with("d"))
pivot_quantiles_wider(tib, d2)

cmu-delphi/epipredict documentation built on March 5, 2025, 12:17 p.m.