quantile.lvec: Calculate the quantiles of an lvec

Description Usage Arguments Details

View source: R/partial_sort.R

Description

Calculate the quantiles of an lvec

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'lvec'
quantile(
  x,
  probs = seq(0, 1, 0.25),
  names = TRUE,
  na.rm = TRUE,
  true_probs = FALSE,
  ...
)

Arguments

x

an object of type lvec.

probs

a numeric vector with probabilities ([0,1]).

names

add names to the result vector.

na.rm

remove missing values before calculating the quantiles

true_probs

add an attribute with the probabilities at the chosen pivots.

...

ignored.

Details

This function uses a more simple method than that used by the regular quantile method. It sorts the vector (using partial_sort for speed) and selects elements from x that correspond to the given probabilities. For example, when x has length of 11 and prob equal to 0.5, it selects the 6th element from the (partially) sorted x. For large enough vectors this is a reasonable approach.


ldat documentation built on March 26, 2020, 7:59 p.m.

Related to quantile.lvec in ldat...