% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/design-data.R
\name{wf_prepare_design}
\alias{wf_prepare_design}
\title{Prepare outcome-free survey design data}
\usage{
wf_prepare_design(
  data,
  id,
  calibration,
  base_weight = NULL,
  strata = NULL,
  clusters = NULL,
  fpc = NULL
)
}
\arguments{
\item{data}{A data frame containing design variables only.}

\item{id}{Name of the unique, non-missing record identifier column.}

\item{calibration}{Names of columns permitted for calibration.}

\item{base_weight}{Optional name of a positive base-weight column.}

\item{strata}{Optional names of stratification columns.}

\item{clusters}{Optional names of cluster columns.}

\item{fpc}{Optional names of finite-population-correction columns.}
}
\value{
A \code{wf_design_data} object.
}
\description{
Creates a strict design object containing only identifiers, calibration
variables, and declared sampling-design fields. Any undeclared column blocks
construction so study outcomes cannot silently enter weight planning.
}
\examples{
design_frame <- data.frame(
  id = sprintf("r\%02d", 1:8),
  sex = rep(c("F", "M"), 4),
  age = rep(c("18-34", "35+"), each = 4),
  base_weight = 1,
  stringsAsFactors = FALSE
)

design <- wf_prepare_design(
  design_frame,
  id = "id",
  calibration = c("sex", "age"),
  base_weight = "base_weight"
)
design

# An outcome column has no declared design role, so it blocks construction
# instead of silently entering weight planning.
with_outcome <- cbind(
  design_frame,
  satisfaction = seq(40, 70, length.out = 8)
)
try(wf_prepare_design(
  with_outcome,
  id = "id",
  calibration = c("sex", "age"),
  base_weight = "base_weight"
))
}
