View source: R/score_calculator.R
| action_levels | R Documentation |
Assigns monitoring or action levels based on individual percentile ranks using standard IDEFICS thresholds.
action_levels(
df,
sex = NULL,
lvl_name = c("none", "monit", "action"),
perc_level = c(0.9, 0.95),
append = FALSE,
filter = NULL
)
df |
A data frame containing percentile columns such as 'waist_percentile', 'sbp_percentile', 'hdl_percentile', etc. |
sex |
Character vector. Same length as 'age', 'height', and 'values'. Accepts "f" for female or "m" for male. |
lvl_name |
Character vector of level labels. Defaults to 'c("none", "monit", "action")'. |
perc_level |
Numeric vector of two percentiles used as cutoffs. Defaults to 'c(0.9, 0.95)' for 90th and 95th percentile. |
append |
Logical. If 'TRUE', appends action level columns to 'df'. If 'FALSE', returns only the computed levels. |
filter |
Character. Optional. Limits calculation to a specific domain: '"adiposity"', '"blood_pressure"', '"blood_lipids"', '"blood_glu_insu"', or '"overall"'. |
Action levels are derived using 'cut()' on percentile values. For example, a value > 95th percentile maps to '"action"'. HDL is reversed ('1 - hdl_percentile') since low HDL values are considered unhealthy.
A list (or a modified data frame if 'append = TRUE') containing action level classifications for each domain.
df <- data.frame(waist_percentile = c(0.85, 0.96))
action_levels(df)
df <- data.frame(
hdl_percentile = c(0.1,0.5),
homa_percentile = c(0.4,0.9),
trg_percentile = c(0.6,0.5),
waist_percentile = c(0.9,0.99),
sbp_percentile = c(0.8,0.01)
)
action_levels(df)
df <- data.frame(
#sex = c("m", "m"),
hdl_percentile = c(0.1,0.5),
homa_percentile = c(0.4,0.9),
trg_percentile = c(0.6,0.5),
crp_percentile = c(0.95, 0.9),
waist_percentile = c(0.9,0.99),
sbp_percentile = c(0.8,0.01)
)
action_levels(df, sex = c("m", "m"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.