Skip to contents

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 or svyrep.design) or a data.frame for an unweighted survey.

opts

set certain options. See below.

csv

name of a CSV file

Value

Info about the survey.

Details

opts:

  • "nchs":

    • Round counts to the nearest 1,000 -- see set_count_1k().

    • Identify low-precision estimates (surveytable.find_lpe option is TRUE).

    • Percentage CI's: adjust Korn-Graubard CI's for the number of degrees of freedom, matching the SUDAAN calculation (surveytable.adjust_svyciprop option is TRUE).

  • "general":

    • Round counts to the nearest integer -- see set_count_int().

    • Do not look for low-precision estimates (surveytable.find_lpe option is FALSE).

    • Percentage CI's: use standard Korn-Graubard CI's (surveytable.adjust_svyciprop option is FALSE).

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

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)                         │
#> └───────────┴──────────────┴────────────────────────────────────────────────┘
#>