% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/survey-collection.R
\name{add_survey}
\alias{add_survey}
\title{Add Surveys to a \code{survey_collection}}
\usage{
add_survey(.collection, ...)
}
\arguments{
\item{.collection}{A \code{survey_collection}. Named with a leading dot so it
cannot collide with user-supplied names in \code{...} (e.g., a survey named
\code{"x"}).}

\item{...}{One or more surveys to append. Accepts named arguments
(\code{"wave3" = d3}) or bare symbols (\code{d3}, auto-named to \code{"d3"}). If a new
name collides with an existing one (or with another new one), it is
repaired by appending \verb{_1}, \verb{_2}, … and a
\code{surveycore_warning_collection_duplicate_name_repaired} warning is
emitted with the mapping.}
}
\value{
A new \code{survey_collection} with the appended surveys.
}
\description{
Appends one or more surveys to an existing collection and returns a new
\code{survey_collection}. The original collection is unchanged. Surveys may be
passed with explicit names or as bare symbols (auto-named, like
\code{\link[=as_survey_collection]{as_survey_collection()}}). Duplicate names are repaired by appending
\verb{_1}, \verb{_2}, … Existing names are never modified during repair.
}
\details{
Calling \code{add_survey(x)} with no additional surveys returns \code{x} unchanged;
no error is raised.
}
\examples{
d1 <- as_survey(gss_2024, ids = vpsu, weights = wtssps,
                strata = vstrat, nest = TRUE)
d2 <- as_survey(gss_2024, ids = vpsu, weights = wtssps,
                strata = vstrat, nest = TRUE)
coll <- as_survey_collection(a = d1)
coll2 <- add_survey(coll, b = d2)
names(coll2)

}
\seealso{
\code{\link[=as_survey_collection]{as_survey_collection()}}, \code{\link[=remove_survey]{remove_survey()}}

Other collections: 
\code{\link{as_survey_collection}()},
\code{\link{remove_survey}()},
\code{\link{set_collection_id}()},
\code{\link{set_collection_if_missing_var}()},
\code{\link{survey_collection}()}
}
\concept{collections}
