diff --git a/README.md b/README.md index cfeaa2f..3eb09c7 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ product of the R4EPIs project; learn more at ## Installation - ---> +Click here for alternative +installation options If there is a bugfix or feature that is +not yet on CRAN, you can install it via the {drat} package: You can install {epikit} from the R4EPI repository: @@ -56,7 +56,7 @@ You can also install the in-development version from GitHub using the remotes::install_github("R4EPI/epikit") ``` - + ----- @@ -68,7 +68,7 @@ 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: -### Give me a break +## Give me a break 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 @@ -83,7 +83,7 @@ find_breaks(100, snap = 20, ceiling = TRUE) # include the highest number #> [1] 1 41 81 100 ``` -### Table modification +## Table modification These functions all modify the appearance of a table displayed in a report and work best with the `knitr::kable()` function. @@ -139,7 +139,7 @@ df %>% | 5 | 0.83 | 3.14 | 2 | 0.33 | 6.28 | | 6 | 1.00 | 3.14 | 1 | 0.17 | 6.28 | -### Quick proportions with conficence intervals +## Quick proportions with conficence intervals There are three functions that will provide quick statistics for different rates based on binomial estimates of proportions from @@ -177,12 +177,12 @@ case_fatality_rate_df(ebola_sim_clean$linelist, #> # A tibble: 3 x 5 #> gender deaths population cfr ci #> -#> 1 f 1291 2934 44.0 (42.21--45.80) -#> 2 m 1273 2895 44.0 (42.17--45.79) -#> 3 Total 2564 5829 44.0 (42.72--45.26) +#> 1 f 1291 2280 56.6 (54.58--58.64) +#> 2 m 1273 2247 56.7 (54.59--58.69) +#> 3 Total 2564 4527 56.6 (55.19--58.08) ``` -### Inline functions +## Inline functions The inline functions make it easier to print estimates with confidence intervals in reports with the correct number of digits. @@ -205,7 +205,7 @@ refer to `estimate`, `lower`, and `upper` column positions or names. write: `fmt_count(ebola_sim_clean$linelist, gender == "f", hospital == "Rokupa Hospital")` and it would produce: 210 (3.6%) -### Confidence interval manipulation +## Confidence interval manipulation The confidence interval manipulation functions take in a data frame and combine their confidence intervals into a single character string much @@ -251,7 +251,7 @@ merge_ci_df(df, e = 2) #> 5 am 0.155814790 (-0.61--0.93) ``` -### Age categories +## Age categories A couple of functions are dedicated to constructing age categories and partitioning them into separate chunks. diff --git a/docs/articles/intro.html b/docs/articles/intro.html index 84c0e91..7749111 100644 --- a/docs/articles/intro.html +++ b/docs/articles/intro.html @@ -96,44 +96,33 @@

Introduction to epikit

Installation

- + -->

Click here for alternative installation options If there is a bugfix or feature that is not yet on CRAN, you can install it via the {drat} package:

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):

- - -
-
library("epikit")
+ +
+
library("epikit")

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:

Give me a break

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.

-
find_breaks(100) # four breaks from 1 to 100
-#> [1]  1 26 51 76
-find_breaks(100, snap = 20) # four breaks, snap to the nearest 20
-#> [1]  1 41 81
-find_breaks(100, snap = 20, ceiling = TRUE) # include the highest number
-#> [1]   1  41  81 100
+
find_breaks(100) # four breaks from 1 to 100
+#> [1]  1 26 51 76
+find_breaks(100, snap = 20) # four breaks, snap to the nearest 20
+#> [1]  1 41 81
+find_breaks(100, snap = 20, ceiling = TRUE) # include the highest number
+#> [1]   1  41  81 100

@@ -147,18 +136,18 @@

  • merge_ci() combines estimate, lower bound, and upper bound columns into a single column.
  • - + @@ -219,10 +208,10 @@

    a n
    -
    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()
    @@ -293,29 +282,29 @@

  • case_fatality_rate()
  • mortality_rate()
  • - +

    In addition, it’s possible to rapidly calculate Case fatality rate from a linelist, stratified by different groups (e.g. gender):

    - +

    @@ -345,34 +334,34 @@

    This is useful for reporting models:

    - +

    @@ -384,36 +373,36 @@

  • group_age_categories() will take a data frame with different age categories in columns (e.g. years, months, weeks) and combine them into a single column, selecting the column with the lowest priority.
  • - +

    diff --git a/docs/index.html b/docs/index.html index cfc22d6..48787de 100644 --- a/docs/index.html +++ b/docs/index.html @@ -94,47 +94,49 @@

    Installation

    -Click here for alternative +installation options If there is a bugfix or feature that is +not yet on CRAN, you can install it via the {drat} package: + +You can install {epikit} from the R4EPI repository: ``` r +# install.packages("drat") +drat::addRepo("R4EPI") install.packages("epikit") ``` -
    - -

    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):

    - - -
    -
    library("epikit")
    +

    +
    library("epikit")

    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:

    -
    -

    -Give me a break

    +
    +
    +

    +Give me a break

    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.

    -
    find_breaks(100) # four breaks from 1 to 100
    -#> [1]  1 26 51 76
    -find_breaks(100, snap = 20) # four breaks, snap to the nearest 20
    -#> [1]  1 41 81
    -find_breaks(100, snap = 20, ceiling = TRUE) # include the highest number
    -#> [1]   1  41  81 100
    +
    find_breaks(100) # four breaks from 1 to 100
    +#> [1]  1 26 51 76
    +find_breaks(100, snap = 20) # four breaks, snap to the nearest 20
    +#> [1]  1 41 81
    +find_breaks(100, snap = 20, ceiling = TRUE) # include the highest number
    +#> [1]   1  41  81 100
    -
    -

    -Table modification

    +
    +

    +Table modification

    These functions all modify the appearance of a table displayed in a report and work best with the knitr::kable() function.

    • @@ -144,18 +146,18 @@

    • merge_ci() combines estimate, lower bound, and upper bound columns into a single column.
    - +

    a (n)
    @@ -216,10 +218,10 @@

    a n
    -
    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()
    @@ -281,42 +283,42 @@

    a (n)

    -
    -

    -Quick proportions with conficence intervals

    +
    +

    +Quick proportions with conficence intervals

    There are three functions that will provide quick statistics for different rates based on binomial estimates of proportions from binom::binom.wilson()

    - +

    In addition, it’s possible to rapidly calculate Case fatality rate from a linelist, stratified by different groups (e.g. gender):

    - +
    -
    -

    -Inline functions

    +
    +

    +Inline functions

    The inline functions make it easier to print estimates with confidence intervals in reports with the correct number of digits.

    -
    -

    -Confidence interval manipulation

    +
    +

    +Confidence interval manipulation

    The confidence interval manipulation functions take in a data frame and combine their confidence intervals into a single character string much like the inline functions do. There are two flavors:

    • @@ -342,38 +344,38 @@

    This is useful for reporting models:

    - +
    -
    -

    -Age categories

    +
    +

    +Age categories

    A couple of functions are dedicated to constructing age categories and partitioning them into separate chunks.

    • @@ -381,37 +383,36 @@

    • group_age_categories() will take a data frame with different age categories in columns (e.g. years, months, weeks) and combine them into a single column, selecting the column with the lowest priority.
    - -
    +
    diff --git a/docs/news/index.html b/docs/news/index.html index b42b7e3..1588b55 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -127,6 +127,7 @@

    epikit 0.1.0

    diff --git a/docs/reference/age_categories.html b/docs/reference/age_categories.html index f0f1396..4a6b81d 100644 --- a/docs/reference/age_categories.html +++ b/docs/reference/age_categories.html @@ -221,7 +221,8 @@

    Arg

    Value

    -

    a data frame

    +

    a factor representing age ranges, open at the upper end of the range.

    +

    a data frame

    Examples

    diff --git a/docs/reference/attack_rate.html b/docs/reference/attack_rate.html index 268c9bf..8ec96e6 100644 --- a/docs/reference/attack_rate.html +++ b/docs/reference/attack_rate.html @@ -184,7 +184,7 @@

    Arg conf_level

    a number representing the confidence level for which to calculate the confidence interval. Defaults to 0.95, representing a 95% -confidence interval.

    +confidence interval using binom::binom.wilson()

    multiplier @@ -217,6 +217,14 @@

    Arg +

    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

    • +
    +

    Examples

    # Attack rates can be calculated with just two numbers @@ -246,14 +254,15 @@

    Examp #> # A tibble: 3 x 5 #> gender deaths population cfr ci #> <fct> <int> <int> <dbl> <chr> -#> 1 f 1301 2962 43.9 (42.14--45.72) -#> 2 m 1281 2926 43.8 (41.99--45.58) -#> 3 Total 2582 5888 43.9 (42.59--45.12)

    +#> 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)