Learn R Programming

epitabulate (version 0.1.0)

attack_rate: Rates and Ratios

Description

Calculate attack rate, case fatality rate, and mortality rate

Usage

attack_rate(
  cases,
  population,
  conf_level = 0.95,
  multiplier = 100,
  mergeCI = FALSE,
  digits = 2
)

case_fatality_rate( deaths, population, conf_level = 0.95, multiplier = 100, mergeCI = FALSE, digits = 2 )

case_fatality_rate_df( x, deaths, group = NULL, conf_level = 0.95, multiplier = 100, mergeCI = FALSE, digits = 2, add_total = FALSE )

mortality_rate( deaths, population, conf_level = 0.95, multiplier = 10^4, mergeCI = FALSE, digits = 2 )

Value

a data frame with five columns that represent the numerator, denominator, rate, lower bound, and upper bound.

  • attack_rate(): cases, population, ar, lower, upper

  • case_fatality_rate(): deaths, population, cfr, lower, upper

Arguments

cases, deaths

number of cases or deaths in a population. For _df functions, this can be the name of a logical column OR an evaluated logical expression (see examples).

population

the number of individuals in the population.

conf_level

a number representing the confidence level for which to calculate the confidence interval. Defaults to 0.95, representing a 95% confidence interval using binom::binom.wilson()

multiplier

The base by which to multiply the output:

  • multiplier = 1: ratio between 0 and 1

  • multiplier = 100: proportion

  • multiplier = 10^4: x per 10,000 people

mergeCI

Whether or not to put the confidence intervals in one column (default is FALSE)

digits

if mergeCI = TRUE, this determines how many digits are printed

x

a data frame

group

the bare name of a column to use for stratifying the output

add_total

if group is not NULL, then this will add a row containing the total value across all groups.