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

Dev #9

Merged
merged 15 commits into from
Jul 5, 2023
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ rsconnect/

# macOS hidden files
.DS_Store
inst/doc
docs
3 changes: 3 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ Imports:
survival,
stats
Suggests:
knitr,
rmarkdown,
spelling,
testthat (>= 3.0.0)
Config/testthat/edition: 3
Config/Needs/website:
epiverse-trace/epiversetheme
Language: en-US
VignetteBuilder: knitr
10 changes: 7 additions & 3 deletions R/all_data_prep.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
#' @return age_group
#' @examples
#' \dontrun{
#' cohortdata <- data.frame()
#' cohortdata$age.group <- get_age_group(cohortdata, "age", 80, 9)
#' cohortdata <- data(cohortdata)
#' cohortdata$age.group <- get_age_group(
#' data = cohortdata,
#' col_age = "age",
#' max_val = 80,
#' step = 9)
#' }
#' @export
get_age_group <- function(data, col_age, max_val, step, min_val = 0) {
get_age_group <- function(data, col_age, max_val, min_val = 0, step) {
n_steps <- as.integer((max_val - min_val) / step) + 1
limits_low <- c(as.integer(seq(min_val,
max_val,
Expand Down
103 changes: 55 additions & 48 deletions R/coh_data_wrangling.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
#' @examples
#' \dontrun{
#' data("cohortdata")
#' cohortdata$vaccine.status <- set_status(cohortdata,
#' c("vaccine_date_1",
#' "vaccine_date_2"),
#' status = c("v", "u"))
#' cohortdata$vaccine_status <- set_status(
#' data = cohortdata,
#' col_names = c("vaccine_date_1", "vaccine_date_2"),
#' status = c("v", "u"))
#' }
#' @export
set_status <- function(data,
Expand Down Expand Up @@ -99,10 +99,13 @@ set_status <- function(data,
#' @examples
#' \dontrun{
#' data("cohortdata")
#' cohortdata$immunization.death <- get_immunization_date(cohortdata,
#' "death_date", 1, 1,
#' c("vaccine_date_1", "vaccine_date_2"),
#' "2021-12-31",
#' cohortdata$immunization_death <- get_immunization_date(
#' data = cohortdata,
#' outcome_date_col = "death_date",
#' outcome_delay = 0,
#' immunization_delay = 14,
#' vacc_date_col = c("vaccine_date_1", "vaccine_date_2"),
#' end_cohort = "2021-12-31",
#' take_first = FALSE)
#' }
#' @export
Expand Down Expand Up @@ -176,23 +179,27 @@ get_immunization_date <- function(data,
#' @param start_from_immunization TRUE: starts counting time-to-event from
#' immunization date if available
#' FALSE: starts counting time-to-event from the start date of the cohort study
#' @param immunization_date_col name of the column that contains the
#' @param immunization_date_col name of the column that contains the
#' immunization date. Required if start_from_immunization = TRUE
#' @return time-to-event
#' @examples
#' \dontrun{
#' data("cohortdata")
#' cohortdata$immunization_death <-
#' get_immunization_date(cohortdata,
#' "death_date",
#' 1,
#' 1,
#' c("vaccine_date_1", "vaccine_date_2"),
#' "2021-12-31",
#' take_first = FALSE)
#' cohortdata$time_to_death <- get_time_to_event(cohortdata, "death_date",
#' "2021-01-01", "2021-12-31",
#' TRUE, "immunization_death")
#' cohortdata$immunization_death <- get_immunization_date(
#' data = cohortdata,
#' outcome_date_col = "death_date",
#' outcome_delay = 0,
#' immunization_delay = 14,
#' vacc_date_col = c("vaccine_date_1", "vaccine_date_2"),
#' end_cohort = "2021-12-31",
#' take_first = FALSE)
#' cohortdata$time_to_death <- get_time_to_event(
#' data = cohortdata,
#' outcome_date_col = "death_date",
#' start_cohort = "2021-01-01",
#' end_cohort = "2021-12-31",
#' start_from_immunization = TRUE,
#' immunization_date_col = "immunization_death")
#' }
#' @export
get_time_to_event <- function(data, outcome_date_col,
Expand Down Expand Up @@ -254,19 +261,19 @@ get_time_to_event <- function(data, outcome_date_col,
#' @examples
#' \dontrun{
#' data("cohortdata")
#' cohortdata$immunization.death
#' <- get_immunization_date(cohortdata,
#' "death_date",
#' 1,
#' 1,
#' c("vaccine_date_1", "vaccine_date_2"),
#' "2021-12-31",
#' take_first = FALSE)
#' cohortdata$immunization_dose <-
#' get_immunization_dose(cohortdata,
#' "immunization_death",
#' c("vaccine_date_1", "vaccine_date_2"),
#' immunization_delay = 14)
#' cohortdata$immunization_death <- get_immunization_date(
#' data = cohortdata,
#' outcome_date_col = "death_date",
#' outcome_delay = 0,
#' immunization_delay = 14,
#' vacc_date_col = c("vaccine_date_1", "vaccine_date_2"),
#' end_cohort = "2021-12-31",
#' take_first = FALSE)
#' cohortdata$immunization_dose <- get_immunization_dose(
#' data = cohortdata,
#' immunization_date_col = "immunization_death",
#' vacc_date_col = c("vaccine_date_1", "vaccine_date_2"),
#' immunization_delay = 14)
#' }
#' @export
get_immunization_dose <- function(data,
Expand Down Expand Up @@ -319,20 +326,20 @@ get_immunization_dose <- function(data,
#' @examples
#' \dontrun{
#' data("cohortdata")
#' cohortdata$immunization_death
#' <- get_immunization_date(cohortdata,
#' "death_date",
#' 1,
#' 1,
#' c("vaccine_date_1","vaccine_date_2"),
#' "2021-12-31",
#' take_first = FALSE)
#' cohortdata$immunization.vaccine
#' <- get_immunization_vaccine(cohortdata,
#' "immunization_death",
#' c("vaccine_date_1", "vaccine_date_2"),
#' c("vaccine_1", "vaccine_2"),
#' immunization_delay = 14)
#' cohortdata$immunization_death <- get_immunization_date(
#' data = cohortdata,
#' outcome_date_col = "death_date",
#' outcome_delay = 0,
#' immunization_delay = 14,
#' vacc_date_col = c("vaccine_date_1", "vaccine_date_2"),
#' end_cohort = "2021-12-31",
#' take_first = FALSE)
#' cohortdata$immunization_vaccine <- get_immunization_vaccine(
#' data = cohortdata,
#' immunization_date_col = "immunization_death",
#' vacc_date_col = c("vaccine_date_1", "vaccine_date_2"),
#' vacc_name_col = c("vaccine_1", "vaccine_2"),
#' immunization_delay = 14)
#' }
#' @export
get_immunization_vaccine <- function(data,
Expand Down Expand Up @@ -391,4 +398,4 @@ get_immunization_vaccine <- function(data,
data <- merge(x = data, y = long1, by = "id", all.x = TRUE)
data <- data[order(data$id), ]
return(data$vaccine)
}
}
14 changes: 7 additions & 7 deletions R/coh_effectiveness.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ coh_eff_noconf <- function(data,
ph <- "accept"
}
df_summ <- data.frame(HR = hr,
HR.low = ci025,
HR.high = ci975,
V.eff = 1 - hr,
V.eff.low = 1 - ci975,
V.eff.high = 1 - ci025,
HR_low = ci025,
HR_high = ci975,
V_eff = 1 - hr,
V_eff_low = 1 - ci975,
V_eff_high = 1 - ci025,
PH = ph,
p.value = p_value)
p_value = p_value)
return(df_summ)
}
}
2 changes: 1 addition & 1 deletion R/coh_performance.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ coh_test_noconf <- function(data, outcome_status_col,
~ data[[status_vacc_col]])
test <- survival::cox.zph(cx)
return(test)
}
}
2 changes: 1 addition & 1 deletion R/cohortdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
#'
#' @examples
#' cohortdata
"cohortdata"
"cohortdata"
15 changes: 15 additions & 0 deletions R/screeningdata.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#' Screening method data on vaccineff
#'
#' Data from
#'
#' @docType data
#'
#' @usage screeningdata
#'
#' @format An object of class \code{"cross"}; see \code{\link[qtl]{read.cross}}.
#'
#' @keywords datasets
#'
#' @examples
#' screeningdata
"screeningdata"
15 changes: 15 additions & 0 deletions R/testnegdata.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#' Test-negative data on vaccineff
#'
#' Data from
#'
#' @docType data
#'
#' @usage testnegdata
#'
#' @format An object of class \code{"cross"}; see \code{\link[qtl]{read.cross}}.
#'
#' @keywords datasets
#'
#' @examples
#' testnegdata
"testnegdata"
28 changes: 24 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ knitr::opts_chunk$set(
MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/mit/)
[![Codecov test
coverage](https://codecov.io/gh/%7B%7B%20gh_repo%20%7D%7D/branch/main/graph/badge.svg)](https://app.codecov.io/gh/%7B%7B%20gh_repo%20%7D%7D?branch=main)
[![lifecycle-concept](https://raw.githubusercontent.com/reconverse/reconverse.github.io/master/images/badge-concept.svg)](https://www.reconverse.org/lifecycle.html#concept)
[![lifecycle-experimental](https://raw.githubusercontent.com/reconverse/reconverse.github.io/master/images/badge-experimental.svg)](https://www.reconverse.org/lifecycle.html#concept)

<!-- badges: end -->

Expand All @@ -43,8 +43,8 @@ You can install the development version of **vaccineff** from
[GitHub](https://github.com/) with:

``` r
if(!require("remotes")) install.packages("remotes")
remotes::install_github("TRACE-LAC/vaccineff")
install.packages("remotes")
remotes::install_github("epiverse-trace/vaccineff")
```

## Quick start
Expand All @@ -63,7 +63,6 @@ data("cohortdata")
head(cohortdata, 5)
```


### Contributions

Contributors to the project include:
Expand All @@ -76,3 +75,24 @@ Contributors to the project include:
- [Santiago Loaiza](https://github.com/santilo9513) (author)

- [Geraldine Gómez](https://github.com/GeraldineGomez) (contributor)

- [Jaime A. Pavlich-Mariscal](https://github.com/jpavlich) (contributor)

## Package vignettes

More details on how to use `vaccineff` can be found in the online documentation as package vignettes, under Get Started with vaccineff, Vaccine Effectiveness Models in vaccineff and Vaccine effectiveness Use Cases for vaccineff

## Help

To report a bug please open an [issue](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).

## Contribute

Contributions to `vaccineff` are welcomed. Please follow the [package contributing guide](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).

## Code of Conduct

Please note that the `vaccineff` project is released with a [Contributor
Code of
Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.
33 changes: 30 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/mit/)
[![Codecov test
coverage](https://codecov.io/gh/%7B%7B%20gh_repo%20%7D%7D/branch/main/graph/badge.svg)](https://app.codecov.io/gh/%7B%7B%20gh_repo%20%7D%7D?branch=main)
[![lifecycle-concept](https://raw.githubusercontent.com/reconverse/reconverse.github.io/master/images/badge-concept.svg)](https://www.reconverse.org/lifecycle.html#concept)
[![lifecycle-experimental](https://raw.githubusercontent.com/reconverse/reconverse.github.io/master/images/badge-experimental.svg)](https://www.reconverse.org/lifecycle.html#concept)

<!-- badges: end -->

Expand All @@ -28,8 +28,8 @@ You can install the development version of **vaccineff** from
[GitHub](https://github.com/) with:

``` r
if(!require("remotes")) install.packages("remotes")
remotes::install_github("TRACE-LAC/vaccineff")
install.packages("remotes")
remotes::install_github("epiverse-trace/vaccineff")
```

## Quick start
Expand Down Expand Up @@ -62,3 +62,30 @@ Contributors to the project include:
- [Santiago Loaiza](https://github.com/santilo9513) (author)

- [Geraldine Gómez](https://github.com/GeraldineGomez) (contributor)

- [Jaime A. Pavlich-Mariscal](https://github.com/jpavlich) (contributor)

## Package vignettes

More details on how to use `vaccineff` can be found in the online
documentation as package vignettes, under Get Started with vaccineff,
Vaccine Effectiveness Models in vaccineff and Vaccine effectiveness Use
Cases for vaccineff

## Help

To report a bug please open an
[issue](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).

## Contribute

Contributions to `vaccineff` are welcomed. Please follow the [package
contributing
guide](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).

## Code of Conduct

Please note that the `vaccineff` project is released with a [Contributor
Code of
Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.
3 changes: 2 additions & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
url: ~
template:
package: epiversetheme
bootstrap: 5

Binary file added data/screeningdata.RData
Binary file not shown.
Binary file added data/testnegdata.RData
Binary file not shown.
Binary file added inst/extdata/screeningdata.RData
Binary file not shown.
Binary file added inst/extdata/screeningdata.rds
Binary file not shown.
Binary file added inst/extdata/testnegdata.RData
Binary file not shown.
Binary file added inst/extdata/testnegdata.rds
Binary file not shown.
14 changes: 9 additions & 5 deletions man/get_age_group.Rd

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

Loading