% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sf_instrument.R
\name{sf_instrument}
\alias{sf_instrument}
\title{Create a survey instrument object}
\usage{
sf_instrument(
  title,
  version = "0.1.0",
  description = NULL,
  authors = NULL,
  languages = "en",
  components = list(),
  render = NULL,
  analysis_plan = list(),
  models = list()
)
}
\arguments{
\item{title}{Character. The title of the survey instrument.}

\item{version}{Character. A semantic version string. Defaults to \code{"0.1.0"}.}

\item{description}{Character or NULL. A brief description of the instrument
and its intended population or purpose.}

\item{authors}{Character vector or NULL. Author names, used in codebooks
and reports.}

\item{languages}{Character vector. Language codes for the instrument.
Defaults to \code{"en"}. Multi-language support is planned for a later release.}

\item{components}{List. A list of component objects created by the
constructor family: \code{\link[=sf_item]{sf_item()}}, \code{\link[=sf_choices]{sf_choices()}}, \code{\link[=sf_scale]{sf_scale()}},
\code{\link[=sf_branch]{sf_branch()}}, and \code{\link[=sf_check]{sf_check()}}. Components are sorted by class
automatically. Supply components created by the surveyframe constructors.}

\item{render}{List or NULL. Optional rendering hints passed to
\code{\link[=render_survey]{render_survey()}}, such as theme colour or progress bar visibility.}

\item{analysis_plan}{List. Optional pre-planned analysis blocks created in
the HTML SurveyBuilder Analyse mode.}

\item{models}{List. Optional model specifications created with \code{\link[=sf_model]{sf_model()}}
or imported from a \code{.sframe} file.}
}
\value{
An object of class \code{sframe} with slots \code{meta}, \code{items}, \code{choices},
\code{scales}, \code{branching}, \code{checks}, \code{analysis_plan}, \code{models}, and \code{render}.
}
\description{
Assembles a survey instrument from its component objects. This is
the top-level constructor for the \code{sframe} class. All other constructors
(\code{\link[=sf_item]{sf_item()}}, \code{\link[=sf_choices]{sf_choices()}}, \code{\link[=sf_scale]{sf_scale()}}, \code{\link[=sf_branch]{sf_branch()}}, \code{\link[=sf_check]{sf_check()}})
produce components that are passed into this function via \code{components}.
}
\examples{
choices <- sf_choices("agree5", 1:5,
  c("Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"))

item1 <- sf_item("sat_1", "The service met my expectations.",
                 type = "likert", choice_set = "agree5",
                 scale_id = "sat", required = TRUE)
item2 <- sf_item("sat_2", "I would recommend this service.",
                 type = "likert", choice_set = "agree5",
                 scale_id = "sat", required = TRUE)

scale <- sf_scale("sat", "Satisfaction", items = c("sat_1", "sat_2"))

instr <- sf_instrument(
  title      = "Service Quality Survey",
  version    = "1.0.0",
  components = list(choices, item1, item2, scale)
)
print(instr)
}
\seealso{
\code{\link[=sf_item]{sf_item()}}, \code{\link[=sf_choices]{sf_choices()}}, \code{\link[=sf_scale]{sf_scale()}}, \code{\link[=sf_branch]{sf_branch()}},
\code{\link[=sf_check]{sf_check()}}, \code{\link[=validate_sframe]{validate_sframe()}}, \code{\link[=write_sframe]{write_sframe()}}
}
