% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sf_scale.R
\name{sf_scale}
\alias{sf_scale}
\title{Define a scored scale}
\usage{
sf_scale(
  id,
  label,
  items,
  method = c("mean", "sum"),
  min_valid = NULL,
  reverse_items = NULL,
  weights = NULL
)
}
\arguments{
\item{id}{Character. A unique identifier for this scale. Referenced in the
\code{scale_id} argument of \code{\link[=sf_item]{sf_item()}}.}

\item{label}{Character. A human-readable name for the scale, used in
reports and codebooks.}

\item{items}{Character vector. The \code{id} values of items that belong to this
scale. Order controls presentation in reports; scoring uses the same item
IDs regardless of order.}

\item{method}{Character. Scoring method. Either \code{"mean"} (default) or
\code{"sum"}.}

\item{min_valid}{Integer or NULL. The minimum number of non-missing items
required to compute a score for a respondent. When \code{NULL}, all items must
be present. Used by \code{\link[=score_scales]{score_scales()}}.}

\item{reverse_items}{Character vector or NULL. A subset of \code{items} that are
reverse-coded. These can also be flagged at the item level with the
\code{reverse} argument in \code{\link[=sf_item]{sf_item()}}. Both sources are respected.}

\item{weights}{Numeric vector or NULL. Item weights for weighted scoring.
Must have the same length as \code{items} if supplied. \code{\link[=score_scales]{score_scales()}}
applies the weights to either \code{method = "mean"} or \code{method = "sum"}.}
}
\value{
An object of class \code{sf_scale} (a named list).
}
\description{
Creates a scale definition that groups items and specifies how composite
scores are computed. The scale carries scoring rules used by \code{\link[=score_scales]{score_scales()}}
and measurement structure used by \code{\link[=reliability_report]{reliability_report()}}, \code{\link[=item_report]{item_report()}},
and \code{\link[=cfa_syntax]{cfa_syntax()}}.
}
\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
)
}
\seealso{
\code{\link[=sf_item]{sf_item()}}, \code{\link[=score_scales]{score_scales()}}, \code{\link[=reliability_report]{reliability_report()}}
}
