Creates a scale definition that groups items and specifies how composite
scores are computed. The scale carries scoring rules used by score_scales()
and measurement structure used by reliability_report(), item_report(),
and cfa_syntax().
Usage
sf_scale(
id,
label,
items,
method = c("mean", "sum"),
min_valid = NULL,
reverse_items = NULL,
weights = NULL
)Arguments
- id
Character. A unique identifier for this scale. Referenced in the
scale_idargument ofsf_item().- label
Character. A human-readable name for the scale, used in reports and codebooks.
- items
Character vector. The
idvalues of items that belong to this scale. Order controls presentation in reports; scoring uses the same item IDs regardless of order.- method
Character. Scoring method. Either
"mean"(default) or"sum".- min_valid
Integer or NULL. The minimum number of non-missing items required to compute a score for a respondent. When
NULL, all items must be present. Used byscore_scales().- reverse_items
Character vector or NULL. A subset of
itemsthat are reverse-coded. These can also be flagged at the item level with thereverseargument insf_item(). Both sources are respected.- weights
Numeric vector or NULL. Item weights for weighted scoring. Must have the same length as
itemsif supplied.score_scales()applies the weights to eithermethod = "mean"ormethod = "sum".
Examples
sat_scale <- sf_scale(
id = "satisfaction",
label = "Customer Satisfaction",
items = c("sat_overall", "sat_speed", "sat_quality"),
method = "mean",
min_valid = 2,
reverse_items = NULL
)