An S7 container that holds multiple independent survey_base objects
(e.g., multiple waves of a panel or cross-sectional series) for
comparative analysis. Create with as_survey_collection().
Arguments
- surveys
A named list of
survey_baseobjects.- groups
Character vector of grouping variable names. Every member's
@groupsmust beidentical()to this value. Defaultcharacter(0).- id
Character(1). Identifier column name used when dispatching analysis functions across the collection. Default
".survey".- if_missing_var
Character(1), one of
c("error", "skip"). Default"error". Controls how dispatchedget_*()functions behave when a member survey is missing a requested variable.
Details
survey_collection deliberately does not inherit from
survey_base. This prevents collection-of-collections nesting: a
survey_collection passed as an element of another collection fails
the element-type check automatically.
Each element of @surveys is an independent survey_base subclass
object (e.g., survey_taylor, survey_replicate, survey_twophase,
survey_nonprob). Mixed-type collections are allowed — the collection
never combines designs, so heterogeneous classes cannot produce an
invalid state.
Properties
surveysA fully named list of
survey_baseobjects. Length \(\geq 1\). Names are unique, non-NA, and non-empty.groupsA character vector of grouping variable names applied uniformly across every member survey. Default
character(0)(ungrouped). When non-empty, every member's@groupsis assertedidentical()to this value.idCharacter(1). Identifier column name injected by
.dispatch_over_collection()when aget_*()is called on the collection. Default".survey". Stored on the collection and consumed as the per-call default; a non-NULL.idat the analysis-function call site overrides this stored value. Mutate viaset_collection_id().if_missing_varCharacter(1), one of
c("error", "skip"). Default"error". Controls how dispatchedget_*()functions behave when a member is missing a requested variable. Stored on the collection and consumed as the per-call default; a non-NULL.if_missing_varat the analysis-function call site overrides this stored value. Mutate viaset_collection_if_missing_var().
See also
as_survey_collection() to build a collection from survey
objects; add_survey() / remove_survey() to mutate an existing
collection.
Other collections:
add_survey(),
as_survey_collection(),
remove_survey(),
set_collection_id(),
set_collection_if_missing_var()
