% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/core-metadata.R
\name{extract_metadata}
\alias{extract_metadata}
\title{Extract All Metadata for Variables}
\usage{
extract_metadata(x, ..., fill = NULL)
}
\arguments{
\item{x}{A survey design object or \code{data.frame}.}

\item{...}{<\code{\link[tidyselect:language]{tidy-select}}> Variables to query.
Supports selection helpers: \code{\link[tidyselect:starts_with]{tidyselect::starts_with()}},
\code{\link[tidyselect:all_of]{tidyselect::all_of()}}, \code{\link[tidyselect:all_of]{tidyselect::any_of()}}, \code{\link[tidyselect:starts_with]{tidyselect::matches()}},
etc. If empty, returns metadata for all variables. Use
\code{\link[tidyselect:all_of]{tidyselect::any_of()}} to silently skip missing variable names.}

\item{fill}{\code{NULL} (default) or \code{"include"}. \code{NULL} omits variables that
have no metadata in any field; \code{"include"} returns all variables
regardless.}
}
\value{
A named list. Each entry is a named list with keys:
\code{variable_label}, \code{value_labels}, \code{question_preface}, \code{note},
\code{universe}, \code{missing_codes}, \code{transformations}.
}
\description{
Returns a summary of all metadata fields for one or more variables in a
survey design object or data frame. Useful for auditing metadata state or
building codebooks.
}
\examples{
d <- as_survey(nhanes_2017, ids = sdmvpsu, weights = wtint2yr,
               strata = sdmvstra, nest = TRUE)
d <- set_universe(d, ridageyr = "All participants 0+")
extract_metadata(d, ridageyr)
extract_metadata(d, fill = "include")

}
\seealso{
Other metadata: 
\code{\link{classify_question_type}()},
\code{\link{extract_missing_codes}()},
\code{\link{extract_question_preface}()},
\code{\link{extract_sata}()},
\code{\link{extract_universe}()},
\code{\link{extract_val_labels}()},
\code{\link{extract_var_label}()},
\code{\link{extract_var_note}()},
\code{\link{infer_question_prefaces}()},
\code{\link{set_missing_codes}()},
\code{\link{set_question_preface}()},
\code{\link{set_sata}()},
\code{\link{set_universe}()},
\code{\link{set_val_labels}()},
\code{\link{set_var_label}()},
\code{\link{set_var_note}()},
\code{\link{survey_metadata}()},
\code{\link{survey_weighting_history}()}
}
\concept{metadata}
