
Calculate the rates for categorical (factor) or logical variables.
tab_rate(
vr,
pop,
per = getOption("surveytable.rate_per"),
drop_na = getOption("surveytable.drop_na"),
max_levels = getOption("surveytable.max_levels"),
csv = getOption("surveytable.csv")
)
A list of tables or a single table.
variable to tabulate
either a single number or a data.frame
with columns named
Level
and Population
. Level
must
exactly match the levels of vr
. Population
is the population for that
level of vr
.
calculate rate per this many items in the population
drop missing values (NA
)?
a categorical variable can have at most this many levels. Used to avoid printing huge tables.
name of a CSV file
Other tables:
tab()
,
tab_cross()
,
tab_subset_rate()
,
total()
,
total_rate()
set_survey(namcs2019sv)
# pop is a data frame
tab_rate("MSA", uspop2019$MSA)
# pop is a single number
tab_rate("MDDO", uspop2019$total)
Run the code above in your browser using DataLab