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

Merge contributions from summit's challenge #22

Merged
merged 80 commits into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
6f5467d
Merge pull request #2 from TRACE-LAC/dev
GeraldineGomez Jun 26, 2023
43a47a9
Merge pull request #4 from TRACE-LAC/dev
tracelac Jun 28, 2023
214d548
Merge pull request #9 from TRACE-LAC/dev
GeraldineGomez Jul 5, 2023
13ccfac
Merge pull request #11 from epiverse-trace/dev
davidsantiagoquevedo Jul 5, 2023
a707fee
Initial styler run on R files
pratikunterwegs Jul 5, 2023
3816b92
Styler run on vignette
pratikunterwegs Jul 5, 2023
d404c67
Styler run on regenerated documentation
pratikunterwegs Jul 5, 2023
a87e176
Correct spellings and update WORDLIST
pratikunterwegs Jul 5, 2023
996c620
Automatic readme update
actions-user Jul 5, 2023
ec07d64
Remove empty file visualisation.R
pratikunterwegs Jul 5, 2023
751ccff
Add author ORCIDs, URL, BugReports to DESCRIPTION
pratikunterwegs Jul 5, 2023
a7dc44d
Add author ORCID
pratikunterwegs Jul 5, 2023
9dd9336
Update title and description in DESCRIPTION
pratikunterwegs Jul 5, 2023
239ce45
Add R dependency >= 3.5.0 for serialised data
pratikunterwegs Jul 5, 2023
ed0886d
Update WORDLIST and pkg doc Rd with study authors
pratikunterwegs Jul 5, 2023
11776c8
Edit Readme to allow automated packagename and GH repo
pratikunterwegs Jul 5, 2023
7893f43
Add contributing guide
pratikunterwegs Jul 5, 2023
8d15476
Automatic readme update
actions-user Jul 5, 2023
02d2a5f
Add general reference to Readme & vignette, add CSL refs file
pratikunterwegs Jul 5, 2023
ffb809f
Automatic readme update
actions-user Jul 5, 2023
974fa7f
Update WORDLIST for Readme updates
pratikunterwegs Jul 5, 2023
e3de11f
Add {qtl} to Suggests to avoid GHA R CMD check Note
pratikunterwegs Jul 5, 2023
65536cd
Update WORDLIST with word in paper title
pratikunterwegs Jul 5, 2023
b2ab24f
Update LICENSE files with correct year and pkg name
pratikunterwegs Jul 5, 2023
9c77115
Add input checking get_age_group
pratikunterwegs Jul 5, 2023
df84f34
Minor formatting edits get_age_group()
pratikunterwegs Jul 5, 2023
12200e8
Update documentation get_age_groups()
pratikunterwegs Jul 5, 2023
77fc46d
Add testthat.R file
pratikunterwegs Jul 5, 2023
fe87ab2
Add tests for get_age_groups()
pratikunterwegs Jul 5, 2023
627c992
Add {checkmate} to Imports
pratikunterwegs Jul 5, 2023
85047ce
Update documentation get_age_group()
pratikunterwegs Jul 5, 2023
7eaa6be
Ignore scratch file for development
pratikunterwegs Jul 5, 2023
9653755
Add input checking for set_status()
pratikunterwegs Jul 7, 2023
88d6a4d
Update documentation for set_status()
pratikunterwegs Jul 7, 2023
aece3d1
Add operator argument options for set_status()
pratikunterwegs Jul 7, 2023
7a18cb7
Add basic tests for set_status()
pratikunterwegs Jul 7, 2023
70f4e27
Update set_status() Rd file
pratikunterwegs Jul 7, 2023
8fd7455
Do not lint any and all usage in tests
pratikunterwegs Jul 7, 2023
08a43d7
Input checking, minor rearrangement, and docs for coh_effectiveness()
pratikunterwegs Jul 7, 2023
9e97ecc
Nolint surv object for coxph, avoid warning from coxph
pratikunterwegs Jul 7, 2023
c80f7c7
Use epiverse pkgdown theme
Bisaloo Jul 10, 2023
bfc6675
Add snapshot test for get_immunization_date()
pratikunterwegs Jul 10, 2023
86065ec
Add input checking for get_immunization_date()
pratikunterwegs Jul 10, 2023
fd24683
Simplify calculations in get_immunization_date(), rm dependencies
pratikunterwegs Jul 10, 2023
340c3bb
Run examples for get_immunization_date(), update Rd documentation, fo…
pratikunterwegs Jul 10, 2023
23ed0bc
Remove {rlang} from Imports
pratikunterwegs Jul 10, 2023
a8291df
Add tests for immunization_date()
pratikunterwegs Jul 10, 2023
42385e7
Make `coh_eff_noconf` return p-val as a numeric
pratikunterwegs Jul 10, 2023
3982603
Input checking, inherit params for fn coh_test_noconf()
pratikunterwegs Jul 10, 2023
e271ac3
Add tests, update documentation for cohort effectiveness fns
pratikunterwegs Jul 10, 2023
44e1307
Add tests for time_to_event()
pratikunterwegs Jul 10, 2023
46f9bdb
Add input checking for time_to_event()
pratikunterwegs Jul 10, 2023
21ba6ae
Clean up code time_to_event()
pratikunterwegs Jul 10, 2023
c445e20
Handle case of full immunity after cohort end
pratikunterwegs Jul 10, 2023
5a0e416
Handle case of death before full immunity
pratikunterwegs Jul 10, 2023
08aee4a
Cleanup of option from cohort start date
pratikunterwegs Jul 10, 2023
fd135ca
Minor formatting and run examples in time_to_event()
pratikunterwegs Jul 10, 2023
7c9e57f
Update tests for time to event
pratikunterwegs Jul 10, 2023
e4d5440
Update documentation time_to_event()
pratikunterwegs Jul 10, 2023
34c53b5
Correct comments in tests for immunisation_date
pratikunterwegs Jul 10, 2023
2b81a3c
Add tests for immunization_dose()
pratikunterwegs Jul 10, 2023
2a249b6
Add input checking, shorten fn get_immunization_dose()
pratikunterwegs Jul 10, 2023
a83376c
Add tests for immunizing_vaccine - fn broken
pratikunterwegs Jul 10, 2023
8f71cfd
Add snapshot test for immunizing_vaccine()
pratikunterwegs Jul 10, 2023
294c698
Simplify immunization_vaccine() fn
pratikunterwegs Jul 10, 2023
9329811
Update documentation immunization_vaccine()
pratikunterwegs Jul 10, 2023
f2712ff
Remove {dplyr} and {data.table} dependencies
pratikunterwegs Jul 10, 2023
c627e95
Merge pull request #14 from epiverse-trace/epiversetheme
davidsantiagoquevedo Aug 1, 2023
36552ff
Merge branch 'main' into dev-fixes-pratik
davidsantiagoquevedo Aug 5, 2023
60a4efa
Merge pull request #13 from epiverse-trace/dev-fixes-pratik
davidsantiagoquevedo Aug 5, 2023
fe068b3
Merge pull request #19 from epiverse-trace/main
davidsantiagoquevedo Aug 8, 2023
68d785a
added new logo
davidsantiagoquevedo Aug 8, 2023
12a1a00
updated contributions
davidsantiagoquevedo Aug 8, 2023
f7e9a3f
updated contribution list on README
davidsantiagoquevedo Aug 8, 2023
0958449
updated ORCID and contributions
davidsantiagoquevedo Aug 8, 2023
ab6331c
fix: minor typo on authorship
davidsantiagoquevedo Aug 8, 2023
56f1f7f
fix: indentations
davidsantiagoquevedo Aug 8, 2023
9428318
Merge pull request #20 from epiverse-trace/dev-minor-fixes
davidsantiagoquevedo Aug 8, 2023
9d90e39
Automatic readme update
actions-user Aug 8, 2023
3fe41f9
Merge pull request #21 from epiverse-trace/dev
davidsantiagoquevedo Aug 8, 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
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
^\.lintr$
^.*\.Rproj$
^\.Rproj\.user$
^scratch\.R$
41 changes: 41 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Contributing to vaccineff

This outlines how to propose a change to vaccineff.

## Making changes

If you want to make a change, it's a good idea to first file an issue and make sure someone from the team agrees that it’s needed.
If you’ve found a bug, please file an issue that illustrates the bug with a minimal
[reprex](https://www.tidyverse.org/help/#reprex) (this will also help you write a unit test, if needed). See [bug report template](https://github.com/epiverse-trace/vaccineff/issues/new?assignees=&labels=&template=bug_report.md&title=). If you have a feature request see [feature request](https://github.com/epiverse-trace/vaccineff/issues/new?assignees=&labels=&template=feature_request.md&title=).

### Pull request process

See [pull request template](https://github.com/epiverse-trace/vaccineff/blob/main/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md)

* Fork the package and clone onto your computer. If you haven't done this before, we recommend using `usethis::create_from_github("epiverse-trace/vaccineff", fork = TRUE)`.

* Install all development dependencies with `devtools::install_dev_deps()`, and then make sure the package passes R CMD check by running `devtools::check()`.
If R CMD check doesn't pass cleanly, it's a good idea to ask for help before continuing.
* Create a Git branch for your pull request (PR). We recommend using `usethis::pr_init("brief-description-of-change")`.

* Make your changes, commit to git, and then create a PR by running `usethis::pr_push()`, and following the prompts in your browser.
The title of your PR should briefly describe the change.
The body of your PR should contain `Fixes #issue-number`.

* For user-facing changes, add a bullet to the top of `NEWS.md` (i.e. just below the first header). Follow the style described in <https://style.tidyverse.org/news.html>.

### Code style

* New code should follow the tidyverse [style guide](https://style.tidyverse.org).
You can use the [styler](https://CRAN.R-project.org/package=styler) package to apply these styles, but please don't restyle code that has nothing to do with your PR.

* We use [roxygen2](https://cran.r-project.org/package=roxygen2), with [Markdown syntax](https://cran.r-project.org/web/packages/roxygen2/vignettes/rd-formatting.html), for documentation.

* We use [testthat](https://cran.r-project.org/package=testthat) for unit tests.
Contributions with test cases included are easier to accept.

## Code of Conduct

Please note that the vaccineff project is released with a
[Contributor Code of Conduct](https://github.com/epiverse-trace/.github/blob/main/CODE_OF_CONDUCT.md). By contributing to this
project you agree to abide by its terms.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ rsconnect/
.DS_Store
inst/doc
docs

# scratch file for development
scratch.R
32 changes: 20 additions & 12 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
Package: vaccineff
Title: Estimation of the Vaccines Effectiveness Based on Different Designs
Title: Estimate Vaccine Effectiveness Based on Different Study Designs
Version: 0.0.1
Authors@R: c(
person(given = "Zulma M.", family = "Cucunubá", email = "zulma.cucunuba@javeriana.edu.co", role = c("aut", "cre")),
person(given = "David Santiago", family = "Quevedo", email = "ex-dsquevedo@javeriana.edu.co", role = c("aut")),
person(given = "Santiago", family = "Loaiza", email = "santiago.loaiza@javeriana.edu.co", role = c("aut")),
person(given = "Geraldine", family = "Gómez Millán", email = "geralidine.gomez@javeriana.edu.co", role = c("ctb"))
person(given = "Zulma M.", family = "Cucunubá", email = "zulma.cucunuba@javeriana.edu.co", role = c("aut", "cre"),
comment = c(ORCID = "https://orcid.org/0000-0002-8165-3198")),
person(given = "David Santiago", family = "Quevedo", email = "ex-dsquevedo@javeriana.edu.co", role = c("aut"),
comment = c(ORCID = "https://orcid.org/0000-0003-1583-4262)")),
person(given = "Santiago", family = "Loaiza", email = "santiago.loaiza@javeriana.edu.co", role = c("aut"),
comment = c(ORCID = "https://orcid.org/0000-0002-2092-3262")),
person(given = "Geraldine", family = "Gómez Millán", email = "geralidine.gomez@javeriana.edu.co", role = c("ctb"),
comment = c(ORCID = "https://orcid.org/0009-0007-8701-0568")),
person(given = "Pratik", family = "Gupte", email = "pratik.gupte@lshtm.ac.uk", role = c("ctb"),
comment = c(ORCID = "https://orcid.org/0000-0001-5294-7819"))
)
Description: A package to estimate the vaccines effectiveness based on different designs.
following format: Author et al. (2023) <doi:10.5281/zenodo.6619350>.
Description: Estimate vaccine effectiveness based on different observational study designs, as discussed in Torvaldsen and McIntyre (2020) <doi:10.3316/informit.511798489353134>.
URL: https://github.com/epiverse-trace/vaccineff, https://epiverse-trace.github.io/vaccineff/
BugReports: https://github.com/epiverse-trace/vaccineff/issues
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Depends:
R (>= 3.5.0)
Imports:
data.table,
dplyr,
rlang,
survival,
stats
stats,
checkmate
Suggests:
knitr,
rmarkdown,
spelling,
testthat (>= 3.0.0)
testthat (>= 3.0.0),
qtl
Config/testthat/edition: 3
Config/Needs/website:
epiverse-trace/epiversetheme
Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2022
COPYRIGHT HOLDER: readepi authors
YEAR: 2023
COPYRIGHT HOLDER: vaccineff authors
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2022 readepi authors
Copyright (c) 2023 vaccineff authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ export(get_immunization_dose)
export(get_immunization_vaccine)
export(get_time_to_event)
export(set_status)
import(dplyr)
importFrom(dplyr,"%>%")
95 changes: 63 additions & 32 deletions R/all_data_prep.R
Original file line number Diff line number Diff line change
@@ -1,45 +1,76 @@
#' Method for constructing age-group variable from age column
#' This method splits an age interval from min_val to max_val into
#' (max_val-min_val)/step intervals.
#' By default min_val is set 0, however it can be assigned by
#' @title Construct age-group variable from age column
#'
#' @description This method splits an age interval from `min_val` to `max_val`
#' into `(max_val - min_val) / step` intervals.
#' By default `min_val` is set to 0, however it can be assigned by
#' convenience.
#' If the method finds ages greater or equal than max_val
#' it assigns the string ">{max_val}".
#' To avoid errors it is necessary to set step < max_val.
#' If the method finds ages greater or equal than `max_val`
#' it assigns the string `">max_val"`.
#' To avoid errors it is necessary to set `step < max_val`.
#' It is also suggested to choose the step such
#' that max_val%%(step+1) = 0
#' that `max_val %% (step + 1) == 0`.
#'
#' @param data dataset with at least a column containing the age
#' information
#' @param col_age name of the column containing the age
#' information
#' @param max_val maximum value of age interval to split
#' @param step step used to split the age interval
#' @param min_val minimum value of age interval to split
#' @return age_group
#' @examples
#' \dontrun{
#' cohortdata <- data(cohortdata)
#' cohortdata$age.group <- get_age_group(
#' data = cohortdata,
#' col_age = "age",
#' max_val = 80,
#' step = 9)
#' }
#' @param max_val maximum value of age interval to split
#' @param step step used to split the age interval
#' @param min_val minimum value of age interval to split
#' @return A `factor` object of the same length as the number of rows in `data`,
#' with levels corresponding to age bins between `min_val` and `max_val`.
#' Ages above `max_val` are represented as `>max_val`.
#' @export
#' @examples
#' # load data provided with the package
#' data(cohortdata)
#'
#' # assign age groups as a column of the data frame
#' cohortdata$age_group <- get_age_group(
#' data = cohortdata,
#' col_age = "age",
#' max_val = 80,
#' step = 9
#' )
#'
#' # view the data frame with new column
#' head(cohortdata)
get_age_group <- function(data, col_age, max_val, min_val = 0, step) {
# input checking
checkmate::assert_data_frame(
data,
min.rows = 1, min.cols = 1
)
checkmate::assert_string(col_age)
checkmate::assert_names(
names(data),
must.include = col_age
)
checkmate::assert_number(min_val, lower = 0)
checkmate::assert_number(max_val, lower = min_val)
checkmate::assert_number(step, lower = 1, upper = max_val)

# get breaks
n_steps <- as.integer((max_val - min_val) / step) + 1
limits_low <- c(as.integer(seq(min_val,
max_val,
length.out = n_steps)))
limits_hgh <- limits_low + step
lim_labels <- paste(as.character(limits_low), as.character(limits_hgh),
sep = "-")
lim_labels[length(lim_labels)] <- paste0("+",
limits_low[length(limits_low)])
lim_breaks <- c(-Inf, limits_low[2:length(limits_low)] - 1, Inf)
limits_low <- seq.int(
min_val, max_val,
length.out = n_steps
)
limits_high <- limits_low + step

# prepare labels
lim_labels <- paste(limits_low, limits_high, sep = "-")
lim_labels[length(lim_labels)] <- paste0(
">",
limits_low[length(limits_low)]
)
lim_breaks <- c(-Inf, limits_low[seq(2, length(limits_low))] - 1, Inf)

# cut the age data and apply labels
age_group <- cut(data[[col_age]],
breaks = lim_breaks,
labels = lim_labels)
breaks = lim_breaks,
labels = lim_labels
)

return(age_group)
}
Loading
Loading