You can install {epikit} from the R4EPI repository:
- +You can also install the in-development version from GitHub using the {remotes} package (but there’s no guarantee that it will be stable):
- - -The {epikit} was primarily designed to house convenience functions for field epidemiologists to use in tidying their reports. The functions in {epikit} come in a few categories:
If you need a quick function to determine the number of breaks you need for a color scale, you can use find_breaks()
. This will always start from 1, so that you can include zero in your scale when you need to.
merge_ci()
combines estimate, lower bound, and upper bound columns into a single column.library("knitr")
-library("magrittr")
-df <- data.frame(
- `a n` = 1:6,
- `a prop` = round((1:6) / 6, 2),
- `a deff` = round(pi, 2),
- `b n` = 6:1,
- `b prop` = round((6:1) / 6, 2),
- `b deff` = round(pi * 2, 2),
- check.names = FALSE
-)
-knitr::kable(df)
library("knitr")
+library("magrittr")
+df <- data.frame(
+ `a n` = 1:6,
+ `a prop` = round((1:6) / 6, 2),
+ `a deff` = round(pi, 2),
+ `b n` = 6:1,
+ `b prop` = round((6:1) / 6, 2),
+ `b deff` = round(pi * 2, 2),
+ check.names = FALSE
+)
+knitr::kable(df)
a n | @@ -219,10 +208,10 @@
---|
df %>%
- rename_redundant("%" = "prop", "Design Effect" = "deff") %>%
- augment_redundant(" (n)" = " n$") %>%
- knitr::kable()
df %>%
+ rename_redundant("%" = "prop", "Design Effect" = "deff") %>%
+ augment_redundant(" (n)" = " n$") %>%
+ knitr::kable()
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
+#> 1 f 1301 2299 56.6 (54.55--58.60) +#> 2 m 1281 2266 56.5 (54.48--58.56) +#> 3 Total 2582 4565 56.6 (55.12--57.99)