% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/core-metadata.R
\name{set_missing_codes}
\alias{set_missing_codes}
\title{Set Missing Code(s)}
\usage{
set_missing_codes(x, ..., variable = NULL, codes = NULL)
}
\arguments{
\item{x}{A survey design object or a data frame.}

\item{...}{Named arguments where the name is the variable and the value is
a named atomic vector of missing codes. Supports \verb{!!!} list splicing.}

\item{variable}{A character vector of variable names. Use with \code{codes}.}

\item{codes}{A list of named atomic vectors, one per element of \code{variable}.
When \code{variable} has length 1, a bare named atomic vector is also accepted.}
}
\value{
The modified object, invisibly.
}
\description{
Sets missing-value codes for one or more variables. Missing codes are atomic
vectors documenting which data values represent missing data
(e.g., \code{c(Refused = -2L, DontKnow = -1L)}).
}
\details{
Supports Conventions 1, 2, and 3 — see \code{\link[=set_var_label]{set_var_label()}} for details on
the calling conventions. For Convention 3 with a single variable, a bare
named atomic vector is accepted in addition to a list.
}
\examples{
d <- as_survey(gss_2024, ids = vpsu, weights = wtssps,
               strata = vstrat, nest = TRUE)
d <- set_missing_codes(d, happy = c(Refused = -1L, DK = -2L))
extract_missing_codes(d, happy)

}
\seealso{
Other metadata: 
\code{\link{classify_question_type}()},
\code{\link{extract_metadata}()},
\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_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}
