% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/metadata_create.R
\name{metadata_survey_create}
\alias{metadata_survey_create}
\title{Create variable-level metadata from a survey dataset}
\usage{
metadata_survey_create(survey)
}
\arguments{
\item{survey}{A survey object of class [survey()].

  Survey objects are typically created with:

  \itemize{
    \item [read_rds()]
    \item [read_spss()]
    \item [read_dta()]
    \item [read_csv()]
    \item [read_survey()]
  }

  Survey objects can also be created manually from a data frame
  with [survey()].}
}
\value{
A nested data frame containing:

\describe{
  \item{filename}{Original survey file name.}
  \item{id}{Survey identifier.}
  \item{var_name_orig}{Original variable name.}
  \item{class_orig}{Imported storage class.}
  \item{var_label_orig}{Original variable label.}
  \item{labels}{List column of value labels.}
  \item{valid_labels}{List column of non-missing value labels.}
  \item{na_labels}{List column of user-defined missing labels.}
  \item{na_range}{List column containing user-defined missing ranges.}
  \item{n_labels}{Number of labelled categories.}
  \item{n_valid_labels}{Number of non-missing categories.}
  \item{n_na_labels}{Number of missing categories.}
}
}
\description{
Extract variable-level metadata from a survey dataset and return
the result as a nested data frame.
}
\details{
The metadata table contains:

\itemize{
  \item variable names and labels,
  \item imported storage classes,
  \item value labels,
  \item user-defined missing values,
  \item missing value ranges,
  \item and summary counts of labelled categories.
}

For multiple surveys, use [metadata_create()], which applies
`metadata_survey_create()` across a list of surveys or survey files.
}
\examples{
metadata_survey_create(
  survey = read_rds(
    system.file(
      "examples",
      "ZA7576.rds",
      package = "retroharmonize"
    )
  )
)

}
\seealso{
[metadata_create()], [create_variable_catalog()]

Other metadata functions:
\code{\link[=create_codebook]{create_codebook()}},
\code{\link[=is.crosswalk_table]{is.crosswalk_table()}},
\code{\link[=metadata_create]{metadata_create()}}
}
\concept{metadata functions}
