Vectorised function to convert UKKRRI values to quartiles of risk. The function takes a numeric vector of UKKRRI values as input, and returns a vector of quartiles. By default this is also a numeric vector with values 1-4, but this can be changed to a character string vector of R1-R4 to match the nomenclature in the NHSBT ODT documentation by setting the prefix parameter to TRUE. The output can also be as a vector of factors by setting fct to TRUE (this can be combined with the prefix parameter).

ukkrri_q(rri, prefix = FALSE, fct = FALSE)

Arguments

rri

numeric vector of UKKRRI values

prefix

whether to prefix results with "R" (default FALSE)

fct

whether to return results as a factor (default FALSE)

Value

vector of UKKRRI quartiles

Details

The UK KRRI quartile ranges are documented in the UK kidney matching policy which can be found on the NHS Blood & Transplant ODT website at www.odt.nhs.uk

Examples

# obtain quartile of a single value ukkrri_q(1.01)
#> [1] 3
# factor vector of results with prefix rri = c(0.69, 0.75, 0.96, 1.36) ukkrri_q(rri, prefix = TRUE, fct = TRUE)
#> [1] R1 R2 R3 R4 #> Levels: R1 R2 R3 R4