This function wraps gtsummary::add_stat() to calculate and display
attack rates (cases per given population multiplier) with 95% confidence
intervals, using the epitabulate::attack_rate() function internally.
add_ar(
  gts_object,
  case_var,
  population = NULL,
  multiplier = 10^4,
  drop_tblsummary_stat = FALSE
)A gtsummary object created with functions such as
gtsummary::tbl_summary()
A logical variable name in the data indicating case status
(e.g. TRUE for cases).
Optional numeric vector giving the population size for
the denominator. If NULL, the population is inferred from the data.
Numeric multiplier used to scale the attack rate
(e.g. 1 = proportion, 100 = percent, 10^4 = per 10,000).
Logical; if TRUE, removes the original
tbl_summary statistic column (default = FALSE).
A modified gtsummary object with additional columns showing the number of cases, population, attack rate, and 95% confidence interval.