You need to specify a survey before the other functions, such as tab()
,
will work.
Usage
set_survey(design, opts = "NCHS", csv = getOption("surveytable.csv"))
Arguments
- design
either a survey object (
survey.design
orsvyrep.design
) or adata.frame
for an unweighted survey.- opts
set certain options. See below.
- csv
name of a CSV file
Details
opts
:
"nchs"
:Round counts to the nearest 1,000 -- see
set_count_1k()
.Identify low-precision estimates (
surveytable.find_lpe
option isTRUE
).Percentage CI's: adjust Korn-Graubard CI's for the number of degrees of freedom, matching the SUDAAN calculation (
surveytable.adjust_svyciprop
option isTRUE
).
"general":
Round counts to the nearest integer -- see
set_count_int()
.Do not look for low-precision estimates (
surveytable.find_lpe
option isFALSE
).Percentage CI's: use standard Korn-Graubard CI's (
surveytable.adjust_svyciprop
option isFALSE
).
Optionally, the survey can have an attribute called label
, which is the
long name of the survey.
Optionally, each variable in the survey can have an attribute called label
,
which is the variable's long name.
See also
Other options:
set_count_1k()
,
set_output()
,
show_options()
,
surveytable-options
Examples
set_survey(namcs2019sv)
#> Survey info {NAMCS 2019 PUF}
#> ┌───────────┬──────────────┬────────────────────────────────────────────────┐
#> │ Variables │ Observations │ Design │
#> ├───────────┼──────────────┼────────────────────────────────────────────────┤
#> │ 33 │ 8,250 │ Stratified 1 - level Cluster Sampling design │
#> │ │ │ (with replacement) │
#> │ │ │ With (398) clusters. │
#> │ │ │ survey::svydesign(ids = ~CPSUM, strata = │
#> │ │ │ ~CSTRATM, weights = ~PATWT, │
#> │ │ │ data = namcs2019sv_df) │
#> └───────────┴──────────────┴────────────────────────────────────────────────┘
#>