Extract, set, remove, or update the survey design associated with an ego-centered dataset.
Usage
ego_design(x, ...)
# S3 method for class 'egor'
ego_design(x, ...)
# S3 method for class 'nested_egor'
ego_design(x, ...)
ego_design(x, ...) <- value
# S3 method for class 'egor'
ego_design(x, ...) <- value
# S3 method for class 'nested_egor'
ego_design(x, ...) <- value
has_ego_design(x)
# S3 method for class 'egor'
has_ego_design(x)
# S3 method for class 'nested_egor'
has_ego_design(x)
strip_ego_design(x)Arguments
- x
an
egorobject.- ...
arguments to be passed to methods
- value
A
listof arguments tosrvyr::as_survey_design()specifying the sampling design for the egos in terms of the ego variables. Variable names can be referenced as strings, as one-sided formulas, or usingdplyr::select()syntax. It is recommended to usealist()rather thanlist()to construct this argument, particularly when using theselect()syntax. PassNULLto set no design.
Note
This can be useful for adjusting or re-initializing the ego design information after the underlying ego attributes had been modified.
Examples
data(egor32)
ego_design(egor32)
#> Independent Sampling design (with replacement)
#> Called via srvyr
#> Data variables:
#> - .egoID (dbl), sex (fct), age (fct), age.years (int), country (chr), income
#> (dbl)
ego_design(egor32) <- alist(strata = sex)
ego_design(egor32)
#> Stratified Independent Sampling design (with replacement)
#> Called via srvyr
#> Sampling variables:
#> - ids: `1`
#> - strata: sex
#> Data variables:
#> - .egoID (dbl), sex (fct), age (fct), age.years (int), country (chr), income
#> (dbl)