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” |
| 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: a warning is issued if values fall outside 0–2.
- 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 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)
)
# Pre-recode out-of-range values before calling
df2 <- df2 %>% dplyr::mutate(dplyr::across(everything(), ~ ifelse(. < 0 | . > 2, NA_real_, .)))
sarc_f_score(
data = df2,
col_map = list(strength = "str", walking = "walk", chair = "chair", stairs = "stairs", falls = "falls"),
na_action = "keep",
verbose = TRUE
)
#> # A tibble: 3 × 2
#> sarc_f_score sarc_f_high_risk
#> <dbl> <lgl>
#> 1 1 FALSE
#> 2 NA NA
#> 3 NA NAInterpretation: Out-of-range values are set to NA before summing; scores with NA items return NA.
Troubleshooting & common pitfalls
- 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; recode out-of-range items to NA before calling.
- All NA scores: usually due to missing items or coercion to 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(): reading input 'data' — 1 rows × 5 variables
#> sarc_f_score(): col_map (5 columns — 5 specified)
#> strength -> 'Strength'
#> walking -> 'Walking'
#> chair -> 'Chair'
#> stairs -> 'Stairs'
#> falls -> 'Falls'
#> sarc_f_score(): computing markers:
#> sarc_f_score [0-10 sum]
#> sarc_f_high_risk [score >= 4]
#> 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
- Recode out-of-range items to NA before calling 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. - 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