Skip to contents

Overall rate

Usage

total_rate(
  pop,
  per = getOption("surveytable.rate_per"),
  csv = getOption("surveytable.csv")
)

Arguments

pop

population

per

calculate rate per this many items in the population

csv

name of a CSV file

Value

A table

See also

Other tables: tab(), tab_cross(), tab_rate(), tab_subset_rate(), total()

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.                           │
#> │           │              │ namcs2019sv = survey::svydesign(ids = ~CPSUM,  │
#> │           │              │ strata = ~CSTRATM, weights = ~PATWT            │
#> │           │              │ , data = namcs2019sv_df)                       │
#> └───────────┴──────────────┴────────────────────────────────────────────────┘
#> 
total_rate(uspop2019$total)
#> Total (rate per 100 population) {NAMCS 2019 PUF}
#> ┌───────┬───────┬──────┬───────┬───────┐
#> │     n │  Rate │   SE │    LL │    UL │
#> ├───────┼───────┼──────┼───────┼───────┤
#> │ 8,250 │ 320.7 │ 15.1 │ 292.4 │ 351.7 │
#> └───────┴───────┴──────┴───────┴───────┘
#>   N = 8250.                             
#>