Use lapply to a vector of risk factors and return a vector of scores.
get_score(riskfactor, values, scores) get_score_vec(rf_vec, values, scores)
riskfactor | Raw risk factor. |
---|---|
values | Specified risk factors. |
scores | Specified score according to the value. |
rf_vec | A vector of risk factors |
A numeric score.
A vector of score
values <- c(55, 60, 65, 70, 75, 80, 85, 90, 95, 100) scores <- c(1.0000, 0.9747, 0.8967, 0.8303, 0.7730, 0.7232, 0.6793, 0.6405, 0.6059, 0.5748) get_score(57.5, values, scores) # 0.98735#> [1] 0.98735get_score(97.5, values, scores) # 0.59035#> [1] 0.59035get_score(77, values, scores) # 0.75308#> [1] 0.75308get_score_vec(c(57.5, 97.5,77), values, scores)#> [1] 0.98735 0.59035 0.75308