Scope
Compute the 5-item SARC-F sarcopenia screening score (Strength,
Assistance in walking, Rise from chair, Climb stairs, Falls). Items are
expected on a 0–2 scale; total ranges 0–10. Flags
sarc_f_high_risk when total ≥ 4. Includes mapping
validation, NA policies, optional extreme screening/capping, and
non-numeric coercion safeguards.
When to use this
- You have SARC-F questionnaire responses and need the total score plus a high-risk flag.
- You want controlled handling of missing or miscoded responses (0–2 expected) with optional capping.
- You need outputs suitable for downstream modeling or screening summaries.
What you need (inputs & options)
| Argument | Purpose / Options | Notes |
|---|---|---|
| data | Data frame/tibble with SARC-F responses | Columns mapped via col_map
|
| col_map | Named list mapping required items | strength, walking, chair, stairs, falls |
| na_action | Missing-data policy | “keep” (default), “omit”, “error”, “ignore”, “warn” |
| check_extreme | Enable range checks (0–2 expected) | Default FALSE |
| extreme_action | Handling for out-of-range values | “warn” (default), “cap”, “error”, “ignore”, “NA” |
| extreme_rules | Optional per-item bounds c(min, max)
|
Defaults to 0–2 per item |
| verbose | Emit progress messages | Default FALSE |
Required columns (col_map): strength, walking, chair, stairs, falls (expected 0/1/2). Mapped columns must exist.
Units: None. Inputs should already be coded 0–2; no transformation beyond coercion/capping/NA handling.
Handling and expectations
- Validation & coercion: mapped columns must exist; non-numeric inputs are coerced to numeric with warnings if NAs are introduced; non-finite values become NA.
- Missingness:
keep/ignore/warnpropagate NA to the total;omitdrops rows with any required NA;erroraborts if missing. - Out-of-range check: even without
check_extreme, a warning is issued if values fall outside 0–2. Withcheck_extreme = TRUE,extreme_actiondecides warn/cap/error/ignore/NA. - Extreme rules: defaults cap each item to 0–2; can be overridden per
item via
extreme_rules. - Scoring:
sarc_f_scoresums the five items;sarc_f_high_riskis TRUE when score ≥ 4, FALSE otherwise, NA if score is NA. - Empty result: if
na_action = "omit"drops all rows, returns a zero-row tibble with expected columns.
Outputs
- Returns a tibble with
sarc_f_score(0–10, or NA) andsarc_f_high_risk(TRUE/FALSE/NA). - NA arises from missing inputs, NA introduced during coercion, NA set
by extreme handling, or dropped rows under
omit.
Worked example 1: Basic usage (keep NAs)
library(HealthMarkers)
library(tibble)
df <- tibble::tibble(
Strength = c(0, 1, 2, NA),
Walking = c(0, 0, 2, 1),
Chair = c(0, 1, 2, 1),
Stairs = c(0, 1, 2, 1),
Falls = c(0, 0, 1, 0)
)
sarc_f_score(
data = df,
col_map = list(
strength = "Strength",
walking = "Walking",
chair = "Chair",
stairs = "Stairs",
falls = "Falls"
),
na_action = "keep",
verbose = TRUE
)
#> # A tibble: 4 × 2
#> sarc_f_score sarc_f_high_risk
#> <dbl> <lgl>
#> 1 0 FALSE
#> 2 3 FALSE
#> 3 9 TRUE
#> 4 NA NAInterpretation: Rows with complete items return scores; the
row with an NA item yields sarc_f_score = NA and
sarc_f_high_risk = NA.
Worked example 2: Detect and cap miscoded values
df2 <- tibble::tibble(
str = c(0, 3, -1),
walk = c(1, 2, 1),
chair = c(0, 2, 1),
stairs = c(0, 2, 2),
falls = c(0, 0, 1)
)
sarc_f_score(
data = df2,
col_map = list(strength = "str", walking = "walk", chair = "chair", stairs = "stairs", falls = "falls"),
na_action = "keep",
check_extreme = TRUE,
extreme_action = "cap",
verbose = TRUE
)
#> # A tibble: 3 × 2
#> sarc_f_score sarc_f_high_risk
#> <dbl> <lgl>
#> 1 1 FALSE
#> 2 8 TRUE
#> 3 5 TRUEInterpretation: Values outside 0–2 are capped into range before summing; warnings note the corrections. Scores and risk flags are returned for all rows.
Troubleshooting & common pitfalls
- YAML/header: keep the YAML at the top; any text before it breaks knitting.
- Missing columns: ensure every required
col_mapkey is mapped to an existing column. - Non-numeric inputs: coerced with warnings; resulting NAs propagate
unless
omitis used. - Out-of-range values: a warning is emitted even without
check_extreme; setcheck_extreme = TRUE+extreme_action = "cap"or"NA"to enforce bounds. - All NA scores: usually due to missing items, coercion to NA, or NA
introduced by extreme handling with
extreme_action = "NA".
Verbose diagnostics
Enable verbose output to inspect column mapping, row counts, and result summaries during QC:
old_opt <- options(healthmarkers.verbose = "inform")
sarc_f_score(
data.frame(Strength = 1, Walking = 1, Chair = 1, Stairs = 0, Falls = 0),
col_map = list(strength="Strength", walking="Walking", chair="Chair", stairs="Stairs", falls="Falls"),
verbose = TRUE
)
#> sarc_f_score(): preparing inputs
#> sarc_f_score(): column map: strength -> 'Strength', walking -> 'Walking', chair -> 'Chair', stairs -> 'Stairs', falls -> 'Falls'
#> sarc_f_score(): results: sarc_f_score 1/1, sarc_f_high_risk 1/1
#> # A tibble: 1 × 2
#> sarc_f_score sarc_f_high_risk
#> <dbl> <lgl>
#> 1 3 FALSE
options(old_opt)Tips for best results
- Use
check_extreme = TRUEwithextreme_action = "cap"to hard-limit inputs to 0–2 when data may be noisy. - Choose
na_action = "omit"when you need complete-case scores for modeling; usekeep/warnfor exploratory summaries where partial data is expected. - Treat
sarc_f_high_riskas a screening flag (score ≥ 4); follow up with clinical assessment as appropriate.
Validation notes
- Score is a simple sum of the five items; risk flag is
score >= 4when the score is finite. - Default bounds are 0–2 per item; override via
extreme_rulesif your instrument coding differs. - No unit conversion or weighting is applied; inputs should already reflect the standard SARC-F coding.
See also
- Function docs:
?sarc_f_score - Related: frailty_index, health_summary