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

Initial fully functioning package #11

Merged
merged 67 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
c8da570
initial commit for CFR calculation
thimotei Nov 18, 2022
19ce2a9
removing duplicate/redudant functions for new approach
thimotei Nov 18, 2022
337a0f6
editing README to include new use case for Ebola
thimotei Nov 18, 2022
56ca6f5
adding initial plot
thimotei Nov 18, 2022
0a7e4fb
adding ggplot2 dependency and sourcing plotting functions
thimotei Nov 18, 2022
07c7dd6
changing README to reflect changes to script
thimotei Nov 18, 2022
177644a
adding plot to README
thimotei Nov 18, 2022
1b7c2f1
fixing plot in README
thimotei Nov 18, 2022
5460c6e
fixing plot
thimotei Nov 18, 2022
fc2a8bf
removing plot from README
thimotei Nov 18, 2022
9da8481
removing data.table dependency and adding package structure for existing
thimotei Nov 24, 2022
fac4a01
Add unit tests and related snapshots
pratikunterwegs Dec 7, 2022
c0ea481
Remove scripts and plots dirs
pratikunterwegs Dec 7, 2022
fa3c9b9
Add R CMD check, test-coverage, linter workflows
pratikunterwegs Dec 7, 2022
e73e3bd
Add Ebola 1976 outbreak data to package
pratikunterwegs Dec 7, 2022
29138d7
Add Ebola 1976 data file to extdata
pratikunterwegs Dec 7, 2022
f7114ea
Add package infrastructure files
pratikunterwegs Dec 7, 2022
b875b47
Clean static_cfr + exs, output is named vector
pratikunterwegs Dec 7, 2022
dbb7b18
Clean rolling_cfr + exs, use data.table
pratikunterwegs Dec 7, 2022
56428a5
Simplify ccfr_uncertainty, output is named vec
pratikunterwegs Dec 7, 2022
61c66de
Input checks format_cfr, add full example
pratikunterwegs Dec 7, 2022
507d6bd
Clean known_outcomes + example
pratikunterwegs Dec 7, 2022
06aaf06
Update plot fun with input checking and namespacing
pratikunterwegs Dec 7, 2022
5b85c89
Remove old snapshot
pratikunterwegs Dec 7, 2022
b231533
Add datadelay package file
pratikunterwegs Dec 7, 2022
8f12f9c
Add revised documentation
pratikunterwegs Dec 7, 2022
a65cdad
Update DESCR, epiparam to sgsts, rm lubridate/reshap2, add data.table
pratikunterwegs Dec 7, 2022
bfa88a6
Rm ggplot funs, add data.table funs to NAMESPACE
pratikunterwegs Dec 7, 2022
25fa993
Use README.Rmd, add example from scripts
pratikunterwegs Dec 7, 2022
dd7df96
Add render-readme workflow
pratikunterwegs Dec 7, 2022
11c9841
Install epiparameter from Github
pratikunterwegs Dec 7, 2022
bf35c3e
Fix linter errors
pratikunterwegs Dec 7, 2022
874fef8
Ebola data uses Date class
pratikunterwegs Dec 9, 2022
055236f
Allow deaths equal to cases
pratikunterwegs Dec 9, 2022
818be68
Check delay_pmf only if passed
pratikunterwegs Dec 9, 2022
b513c9d
Add Covid-19 USA example
pratikunterwegs Dec 9, 2022
be27220
Add to gitignore
pratikunterwegs Dec 9, 2022
7eaa755
Add {covidregionaldata} to suggests
pratikunterwegs Dec 9, 2022
f29fe18
Use GH version of {covidregionaldata}
pratikunterwegs Dec 9, 2022
87b297e
Update snapshot for dataframe not datatable
pratikunterwegs Dec 9, 2022
e5e291d
Correct rolling_cfr TESTS
pratikunterwegs Dec 14, 2022
7e0ee0c
Add author, add rlang dep
pratikunterwegs Dec 15, 2022
74af936
Rename ccfr_estimation to estimate_ccfr
pratikunterwegs Dec 15, 2022
9131cf0
Input checking and full matching for known_outcomes
pratikunterwegs Dec 15, 2022
0a68321
Initialise output objs, reorder correction workflow
pratikunterwegs Dec 15, 2022
a2daa07
Use .data pronoun from rlang
pratikunterwegs Dec 15, 2022
e8d37e1
Update documentation
pratikunterwegs Dec 15, 2022
c84f972
Correct README to use delay_pmf
pratikunterwegs Dec 15, 2022
072a871
Update plot snapshot and package namespace script
pratikunterwegs Dec 15, 2022
a684736
Update check workflows
pratikunterwegs Dec 15, 2022
f75cf84
Style and add dependency R > 3.5.0
pratikunterwegs Dec 15, 2022
0db25bf
Automatic readme update
actions-user Dec 15, 2022
8cb1987
Vectorise likelihood calculation
pratikunterwegs Dec 15, 2022
498c473
Add figures, fix style, fix examples
pratikunterwegs Dec 15, 2022
6018441
Automatic readme update
actions-user Dec 15, 2022
4a7914b
Correct convolution, fixes #17
pratikunterwegs Dec 16, 2022
9b0a686
Correct likelihood calculation, fixes #18
pratikunterwegs Dec 16, 2022
3748383
Rewrite `rolling_cfr` to avoid repeated `static_cfr` calls
pratikunterwegs Dec 16, 2022
f9d0b4c
Minor corrections; update documentation
pratikunterwegs Dec 16, 2022
2b348fa
Correct snapshots
pratikunterwegs Dec 16, 2022
7834bfb
Update data documentation
pratikunterwegs Dec 16, 2022
964403d
Update README figures
pratikunterwegs Dec 16, 2022
ab4363d
Update static CFR print format
pratikunterwegs Dec 16, 2022
a14329d
Update print CFR snapshots
pratikunterwegs Dec 16, 2022
c804aaa
Clarify rolling CFR as real-time CFR
pratikunterwegs Jan 4, 2023
28b13e6
Automatic readme update
actions-user Jan 4, 2023
be90284
Add usethis to suggests
pratikunterwegs Jan 4, 2023
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
Binary file removed .DS_Store
Binary file not shown.
8 changes: 7 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
^datadelay\.Rproj$
^.*\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^\.github$
^codecov\.yml$
^README\.Rmd$
^\.lintr$
^data-raw$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
50 changes: 50 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches:
- "*"

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

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

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
44 changes: 44 additions & 0 deletions .github/workflows/lint-changed-files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
pratikunterwegs marked this conversation as resolved.
Show resolved Hide resolved
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
pull_request:
branches: [main, master]

name: lint-changed-files

jobs:
lint-changed-files:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::gh
any::lintr
any::purrr
needs: check

- name: Add lintr options
run: |
cat('\noptions(lintr.linter_file = ".lintr")\n', file = "~/.Rprofile", append = TRUE)
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Extract and lint files changed by this PR
run: |
files <- gh::gh("GET https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files")
changed_files <- purrr::map_chr(files, "filename")
all_files <- list.files(recursive = TRUE)
exclusions_list <- as.list(setdiff(all_files, changed_files))
lintr::lint_package(exclusions = exclusions_list)
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
47 changes: 47 additions & 0 deletions .github/workflows/render_readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Name of the workflow
pratikunterwegs marked this conversation as resolved.
Show resolved Hide resolved
name: render-readme

# Controls when the action will run. Triggers include:
#
# - button trigger from github action page
# - on changes to readme.Rmd

on:
workflow_dispatch:
push:
paths:
- 'README.Rmd'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
render-readme:
runs-on: macos-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repos
uses: actions/checkout@v2

- name: Setup R
uses: r-lib/actions/setup-r@v2

- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2

- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rmarkdown, local::.

- name: Compile the readme
run: |
rmarkdown::render("README.Rmd")
shell: Rscript {0}

- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add README.md
git diff-index --quiet HEAD || git commit -m "Automatic readme update"
git push origin || echo "No changes to push"
51 changes: 51 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches:
- "*"

name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: coverage

- name: Test coverage
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
)
shell: Rscript {0}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
.DS_Store
docs
inst/doc
/doc/
/Meta/
10 changes: 10 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
linters: linters_with_tags(
tags = NULL, # include all linters
object_name_linter = NULL,
undesirable_function_linter = NULL,
implicit_integer_linter = NULL,
extraction_operator_linter = NULL,
todo_comment_linter = NULL,
function_argument_linter = NULL
)
exclusions: list("R/RcppExports.R")
42 changes: 36 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,42 @@
Package: datadelay
Title: Delay Functions for Epidemic Data
Version: 0.1
Authors@R:
person("Adam", "Kucharski", , "adam.kucharski@lshtm.ac.uk", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-8814-9421"))
Authors@R: c(
person(
given = "Adam",
family = "Kucharski",
email = "adam.kucharski@lshtm.ac.uk",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-8814-9421")
),
person(
given = "Tim",
family = "Russell",
email = "timothy.russell@lshtm.ac.uk",
role = c("aut"),
comment = c(ORCID = "0000-0001-5610-6080")
)
)
Description: Delay functions for routine surveillance data.
License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a
license
License: MIT + file LICENSE
URL: https://github.com/epiverse-trace/datadelay
BugReports: https://github.com/epiverse-trace/datadelay/issues
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
RoxygenNote: 7.2.2
Imports:
data.table,
ggplot2,
patchwork
Suggests:
testthat (>= 3.0.0),
epiparameter,
usethis,
pratikunterwegs marked this conversation as resolved.
Show resolved Hide resolved
covidregionaldata
Remotes:
epiverse-trace/epiparameter,
epiforecasts/covidregionaldata
Config/testthat/edition: 3
Depends:
R (>= 2.10)
LazyData: true
17 changes: 15 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# Generated by roxygen2: do not edit by hand

export(cases_to_infections)
export(cfr_calculation)
export(ccfr_uncertainty)
export(format_cfr_neatly)
export(known_outcomes)
export(plot_data_and_cfr)
export(rolling_cfr)
export(static_cfr)
importFrom(data.table,":=")
importFrom(data.table,.BY)
importFrom(data.table,.EACHI)
importFrom(data.table,.GRP)
importFrom(data.table,.I)
importFrom(data.table,.N)
importFrom(data.table,.NGRP)
importFrom(data.table,.SD)
importFrom(data.table,data.table)
58 changes: 0 additions & 58 deletions R/cases_to_infections.R

This file was deleted.

Loading