predrisk_grp_prcnt() is a simple wrapper for cut that is meant to be used
to create an input value for scalib_gnd_manual() (specifically, the
group input argument).
predrisk_grp_prcnt(x, g, na.rm = FALSE, type = 7)(numeric vector) a numeric vector which will be converted to a vector of integers by cutting.
(numeric value) the desired number of percentile groups. For
example, g = 10 gives decile groups.
(logical value) if TRUE, any NA and NaN values
are removed from x before the quantiles are computed.
(integer value between 1 and 9) see quantile for details.
a numeric vector with integer values.
set.seed(32987)
predrisk_grp_prcnt(sort(runif(100)), g = 10)
#> [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3
#> [26] 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5
#> [51] 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8
#> [76] 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10