make.quantiles is a wrapper for quantile replacing the input with calculated values. Unmatched quantiles will return NA in order to match the length of the input vector.

make.quantiles(x, ..., as.factor = FALSE)

Arguments

x

The input vector

...

(dots_list): Additional arguments sent to quantile. Defaults are as follows:

  • probs = seq(0, 1, 0.25)

  • na.rm = FALSE

  • names = TRUE

  • type = 7

  • digits = 7

  • ...

as.factor

(logical) Should the output be returned as a factor?

Value

A quantile representation of the input

Note

Any indeterminate probabilities relative to the input will return NA

Examples

sample(900, 20) |> (\(x) data.frame(x = x, q = book.of.features::make.quantiles(x, seq(0, 1, .1), as.factor = TRUE)))()
#>      x    q
#> 1  472  70%
#> 2  768  90%
#> 3  809 100%
#> 4  303  40%
#> 5  680  80%
#> 6  368  50%
#> 7  260  30%
#> 8  471  60%
#> 9  409  50%
#> 10 146  30%
#> 11 144  20%
#> 12 428  60%
#> 13  62  10%
#> 14  91  20%
#> 15 651  80%
#> 16 896 100%
#> 17   4   0%
#> 18 326  40%
#> 19 750  90%
#> 20 584  70%
sample(900, 20) |> (\(x) data.frame(x = x, q = book.of.features::make.quantiles(x, seq(0, 1, .1), as.factor = FALSE)))()
#>      x     q
#> 1   89  97.8
#> 2  100 192.4
#> 3  591 729.4
#> 4  729 729.4
#> 5  156 192.4
#> 6   88  97.8
#> 7  248 285.0
#> 8    8  80.0
#> 9  408 494.4
#> 10 893 893.0
#> 11 731 736.5
#> 12 259 285.0
#> 13 734 736.5
#> 14 208 245.6
#> 15   3   3.0
#> 16 335 364.2
#> 17 311 364.2
#> 18 242 245.6
#> 19 759 893.0
#> 20 453 494.4