Skip to contents

Given a list of quantiles, pair together the ones symmetrical around the median. For example, the 2.5% quantile and 97.5% quantile go together. The 50% quantile will never be paired.

Usage

pair_quantiles(quants)

Arguments

quants

A vector of distinct numbers between 0 and 100.

Value

A named list with two elements: paired, a list of pairs of quantiles, and unpaired, a vector of all the leftover quantiles.

Examples

# list(paired=list(c(15,85), c(30,70)), unpaired=c(0,10,20,50,51,60,75))
casteval:::pair_quantiles(c(0, 10, 15, 20, 30, 50, 51, 60, 70, 75, 85))
#> $paired
#> $paired[[1]]
#> [1] 15 85
#> 
#> $paired[[2]]
#> [1] 30 70
#> 
#> 
#> $unpaired
#> [1]  0 10 20 50 51 60 75
#>