Calculate risk ratios from line-list data

nice_rr(n1, d1, n2, d2)

Arguments

n1

numerator for the reference group

d1

denominator for the reference group

n2

numerator for the comparator group

d2

denominator for the comparator group

Examples

data(smokers)
lc_agg <- smokers %>%
  dplyr::group_by(smoker) %>%
  dplyr::summarise(denominator = dplyr::n(), numerator = sum(lung_cancer)) %>%
  tidyr::pivot_wider(names_from = smoker, values_from = c(denominator, numerator))
lc_agg
#> # A tibble: 1 x 4
#>   denominator_0 denominator_1 numerator_0 numerator_1
#>           <int>         <int>       <int>       <int>
#> 1         60000         30000           6          39
nice_rr(n1 = lc_agg$numerator_0, d1 = lc_agg$denominator_0,
    n2 = lc_agg$numerator_1, d2 = lc_agg$denominator_1)
#>   rr se_log_rr      lci      uci
#> 1 13  0.438472 5.504381 30.70282