View source: R/score_calculator.R
| ScoreCalc | R Documentation |
Applies 'get_scores()' to multiple clinical biomarkers in a data frame and optionally returns MetS and cutoff levels.
ScoreCalc(
df,
return_input = FALSE,
return_values = c("percentile", "z.score", "MetS", "cutoff.levels")
)
df |
A data frame with columns: 'sex', 'age', 'height', and observed values for any of the supported variables: 'bmi', 'glu', 'hdl', 'height', 'homa', 'insu', 'trg', 'waist', 'sbp', 'dbp', 'crp'. Variables must be supplied using the units of the corresponding reference model:
'height' is required for the height-dependent blood-pressure models ('sbp' and 'dbp'). |
return_input |
Logical. If 'TRUE', includes original input columns in the result. Defaults to 'FALSE'. |
return_values |
Character vector. Specifies which scores to compute. Options include '"percentile"', '"z.score"', '"MetS"', and '"cutoff.levels"'. |
The function applies 'get_scores()' to each recognized variable in the input and combines the results. If '"MetS"' is requested, a Metabolic Syndrome score is computed and optionally transformed to percentile ranks/z-scores.
A data frame with score columns named as '<variable>_percentile', '<variable>_z.score', etc. Includes additional columns like 'MetS' or cutoff levels if requested.
df <- data.frame(
sex = c("f", "m"),
age = c(8, 15),
height = c(120, 125),
waist = c(55, 60),
homa = c(1.2, 1.4),
sbp = c(100, 105),
dbp = c(65, 70),
trg = c(80, 90), # mg/dL
crp = c(6, 2), # mg/L
hdl = c(50, 45) # mg/dL
)
ScoreCalc(df, return_values = c("percentile", "cutoff.levels"))
# for the 15 year old male everything except CRP is NA (outside IDEFICS age range)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.