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)

Arguments

x

(numeric vector) a numeric vector which will be converted to a vector of integers by cutting.

g

(numeric value) the desired number of percentile groups. For example, g = 10 gives decile groups.

na.rm

(logical value) if TRUE, any NA and NaN values are removed from x before the quantiles are computed.

type

(integer value between 1 and 9) see quantile for details.

Value

a numeric vector with integer values.

Examples


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