% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/estpw_s1_extract_data.R
\name{extract_analysis_data}
\alias{extract_analysis_data}
\title{Extract analysis data from a survey design object}
\usage{
extract_analysis_data(des, weight_name = "sp_wts")
}
\arguments{
\item{des}{A survey design object of class `survey.design2`
or `svyrep.design`.}

\item{weight_name}{A single string giving the name of the weight column
added to the output. Defaults to `"sp_wts"`. Must not already exist
among the analysis variables after design variables are removed.}
}
\value{
A data frame containing the analysis variables from `des$variables`
  (design variables removed) plus one column named `weight_name` storing
  the sampling weights.
}
\description{
Remove design variables (cluster IDs, strata, FPC, probabilities, weights)
from a survey design object and attaches the sampling weights as a single
column, returning a plain data frame ready for modeling.
}
\details{
Cluster and strata variables are identified from the design object's own
fields (`des$cluster`, `des$strata`) rather than the original call, so the
result is correct even when `des` has been subset after construction.
Weights, FPC, and probability variables are still read from `des$call`.
For replicate designs (`svyrep.design`), replicate weight columns are also
dropped.
}
\keyword{internal}
