Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cran release 02 2023 #36

Merged
merged 13 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
^docs$
^pkgdown$
^CRAN-RELEASE$
^CRAN-SUBMISSION$
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
extra-packages: local::., any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
Expand Down
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 0.1.6
Date: 2024-01-22 23:59:23 UTC
SHA: 07478e47d4472f6943691aaa254a28c1365b6e4a
12 changes: 6 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Package: epikit
Title: Miscellaneous helper tools for epidemiologists
Version: 0.1.4
Title: Miscellaneous Helper Tools for Epidemiologists
Version: 0.1.6
Authors@R:
c(person(given = "Alexander",
family = "Spina",
email = "[email protected]",
comment = c(ORCID = "0000-0001-8425-1867"),
role = c("aut", "cre")),
role = c("aut")),
person(given = "Zhian N.",
family = "Kamvar",
role = "aut",
role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0003-1458-7108")),
person(given = "Dirk",
Expand All @@ -23,7 +23,7 @@ Description: Contains tools for formatting inline code, renaming redundant
columns, aggregating age categories, adding survey weights, finding the earliest
date of an event, plotting z-curves, generating population counts and
calculating proportions with confidence intervals. This is part of the
'R4Epis' project <https://r4epis.netlify.com>.
'R4Epis' project <https://r4epis.netlify.app/>.
License: GPL-3
Encoding: UTF-8
LazyData: true
Expand Down Expand Up @@ -52,7 +52,7 @@ Suggests:
rmarkdown
Additional_repositories: https://r4epi.github.io/drat
URL: https://github.com/R4EPI/epikit,
https://r4epis.netlify.com,
https://r4epis.netlify.app,
https://r4epi.github.io/epikit/
BugReports: https://github.com/R4EPI/epikit/issues
VignetteBuilder: knitr
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ importFrom(sf,st_make_grid)
importFrom(sf,st_polygon)
importFrom(sf,st_set_crs)
importFrom(sf,st_sf)
importFrom(stats,setNames)
importFrom(tibble,as_tibble)
importFrom(utils,read.csv)
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
# epikit 0.1.6

* internal documentation fix. No user-visible changes.

# epikit 0.1.5

* removed tidyr::unite() in favour of paste-ing two columns together
* added `separator` argument to `_ci()` functions which now defaults to `-`
(@aspina7, #31)

# epikit 0.1.4

* unecessary bump because {pkgdown}

# epikit 0.1.3

(non-cran release)

* migrated functions and tests from {sitrep} including: `add_weights_cluster()`,
`add_weights_strata()`, `find_date_cause()`, `find_end_date()`,
`find_start_date()`, `gen_polygon()`, `gen_population()` and `zcurve()` (@aspina7, #22)
Expand Down
1 change: 1 addition & 0 deletions R/epikit-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# roxygen namespace tags. Modify with care!
## usethis namespace: start
#' @importFrom rlang .data :=
#' @importFrom stats setNames
#' @importFrom ggplot2 ggplot
#' @importFrom ggplot2 aes
#' @importFrom ggplot2 stat_density
Expand Down
5 changes: 2 additions & 3 deletions R/relabel_proportions.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ augment_redundant <- function(x, ...) {
#' calls for the express purpose of renaming functions. This function is
#' intended for internal use to be passed to other MSF packages.
#'
#' @param call a language object reflecting the current call.
#' @param ... passed from the calling function
#'
#' @param parent the level of the parent function. Defaults to 1, which
#' selects the dots from the immediate parent.
#'
#' @return a list of character vectors
#' @export
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ knitr::opts_chunk$set(


<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![CRAN status](https://www.r-pkg.org/badges/version/epikit)](https://CRAN.R-project.org/package=epikit)
[![Codecov test coverage](https://codecov.io/gh/R4EPI/epikit/branch/master/graph/badge.svg)](https://codecov.io/gh/R4EPI/epikit?branch=master)
[![Codecov test coverage](https://app.codecov.io/gh/R4EPI/epikit/branch/master/graph/badge.svg)](https://app.codecov.io/gh/R4EPI/epikit?branch=master)
[![R-CMD-check](https://github.com/R4EPI/epikit/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/R4EPI/epikit/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

Expand Down
90 changes: 70 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ epikit
<!-- badges: start -->

[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![CRAN
status](https://www.r-pkg.org/badges/version/epikit)](https://CRAN.R-project.org/package=epikit)
[![Codecov test
coverage](https://codecov.io/gh/R4EPI/epikit/branch/master/graph/badge.svg)](https://codecov.io/gh/R4EPI/epikit?branch=master)
coverage](https://app.codecov.io/gh/R4EPI/epikit/branch/master/graph/badge.svg)](https://app.codecov.io/gh/R4EPI/epikit?branch=master)
[![R-CMD-check](https://github.com/R4EPI/epikit/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/R4EPI/epikit/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

The goal of {epikit} is to provide miscellaneous functions for applied
epidemiologists. This is a product of the R4EPIs project; learn more at
<https://r4epis.netlify.com>.
<https://r4epis.netlify.app/>.

## Installation

Expand Down Expand Up @@ -105,28 +105,78 @@ df %>%
#> 20 30-39 <NA> 30-39 years
```

## 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()`

- `attack_rate()`
- `case_fatality_rate()`
- `mortality_rate()`

``` r
attack_rate(10, 50)
#> cases population ar lower upper
#> 1 10 50 20 11.24375 33.03711
case_fatality_rate(2, 50)
#> deaths population cfr lower upper
#> 1 2 50 4 1.103888 13.46009
mortality_rate(40, 50000)
#> deaths population mortality per 10 000 lower upper
#> 1 40 50000 8 5.87591 10.89109
```

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

``` r
library("outbreaks")
case_fatality_rate_df(ebola_sim_clean$linelist,
outcome == "Death",
group = gender,
add_total = TRUE,
mergeCI = TRUE
)
#> Warning: There was 1 warning in `dplyr::mutate()`.
#> ℹ In argument: `gender = forcats::fct_explicit_na(gender, "(Missing)")`.
#> Caused by warning:
#> ! `fct_explicit_na()` was deprecated in forcats 1.0.0.
#> ℹ Please use `fct_na_value_to_level()` instead.
#> ℹ The deprecated feature was likely used in the epikit package.
#> Please report the issue at <https://github.com/R4EPI/epikit/issues>.
#> # A tibble: 3 × 5
#> gender deaths population cfr ci
#> <fct> <int> <int> <dbl> <chr>
#> 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

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

- `fmt_ci()` formats confidence intervals from three numbers.
(e.g. `fmt_ci(50, 10, 80)` produces 50.00% (CI 10.00-80.00)
- `fmt_pci()` formats confidence intervals from three fractions,
multiplying by 100 beforehand.

<!--
The `_df` suffixes (`fmt_ci_df()`, `fmt_pci_df()`) will print the confidence
intervals for data stored in data frames. These are designed to work with the
outputs of the rates functions. For example, `fmt_ci_df(attack_rate(10, 50))`
will produce . All of these suffixes will have
three options `e`, `l`, and `u`. These refer to `estimate`, `lower`, and `upper`
column positions or names.

- `fmt_count()` will count a condition in a data frame and present the number
and percent of `TRUE` values. For example, if you wanted to count the number
of women patients from Rokupa hospital, you would write: `fmt_count(ebola_sim_clean$linelist, gender == "f", hospital == "Rokupa Hospital")` and it would produce:
-->

- `fmt_ci()` formats confidence intervals from three numbers.
(e.g. `fmt_ci(50, 10, 80)` produces 50.00% (CI 10.00-80.00)
- `fmt_pci()` formats confidence intervals from three fractions,
multiplying by 100 beforehand.

The `_df` suffixes (`fmt_ci_df()`, `fmt_pci_df()`) will print the
confidence intervals for data stored in data frames. These are designed
to work with the outputs of the rates functions. For example,
`fmt_ci_df(attack_rate(10, 50))` will produce 20.00% (CI 11.24-33.04).
All of these suffixes will have three options `e`, `l`, and `u`. These
refer to `estimate`, `lower`, and `upper` column positions or names.

- `fmt_count()` will count a condition in a data frame and present the
number and percent of `TRUE` values. For example, if you wanted to
count the number of women patients from Rokupa hospital, you would
write:
`fmt_count(ebola_sim_clean$linelist, gender == "f", hospital == "Rokupa Hospital")`
and it would produce: 210 (3.6%)

## Confidence interval manipulation

Expand Down
5 changes: 2 additions & 3 deletions man/dots_to_charlist.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions man/epikit-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/rmdhunks/introduction.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The goal of {epikit} is to provide miscellaneous functions for applied epidemiologists.
This is a product of the R4EPIs project; learn more at <https://r4epis.netlify.com>.
This is a product of the R4EPIs project; learn more at <https://r4epis.netlify.app/>.

## Installation

Expand Down
Loading