R/CreateArgFunctions.R

Defines functions createRunSelfControlledCohortArgs

Documented in createRunSelfControlledCohortArgs

# This file has been autogenerated. Do not change by hand. 

#' Create a parameter object for the function runSelfControlledCohort
#'
#' @details
#' Create an object defining the parameter values.
#'
#' @param firstExposureOnly              If TRUE, only use first occurrence of each drug concept idfor
#'                                       each person
#' @param firstOutcomeOnly               If TRUE, only use first occurrence of each condition conceptid
#'                                       for each person.
#' @param minAge                         Integer for minimum allowable age.
#' @param maxAge                         Integer for maximum allowable age.
#' @param studyStartDate                 Date for minimum allowable data for index exposure. Dateformat
#'                                       is 'yyyymmdd'.
#' @param studyEndDate                   Date for maximum allowable data for index exposure. Dateformat
#'                                       is 'yyyymmdd'.
#' @param addLengthOfExposureExposed     If TRUE, use the duration from drugEraStart -> drugEraEnd
#'                                       as part of timeAtRisk.
#' @param riskWindowStartExposed         Integer of days to add to drugEraStart for start oftimeAtRisk
#'                                       (0 to include index date, 1 to start the dayafter).
#' @param riskWindowEndExposed           Additional window to add to end of exposure period
#'                                       (ifaddLengthOfExposureExposed = TRUE, then add to exposure
#'                                       enddate, else add to exposure start date).
#' @param addLengthOfExposureUnexposed   If TRUE, use the duration from exposure start -> exposureend
#'                                       as part of timeAtRisk looking back before exposurestart.
#' @param riskWindowEndUnexposed         Integer of days to add to exposure start for end oftimeAtRisk
#'                                       (0 to include index date, -1 to end the daybefore).
#' @param riskWindowStartUnexposed       Additional window to add to start of exposure period
#'                                       (ifaddLengthOfExposureUnexposed = TRUE, then add to
#'                                       exposureend date, else add to exposure start date).
#' @param hasFullTimeAtRisk              If TRUE, restrict to people who have full time-at-riskexposed
#'                                       and unexposed.
#' @param washoutPeriod                  Integer to define required time observed before exposurestart.
#' @param followupPeriod                 Integer to define required time observed after exposurestart.
#' @param computeTarDistribution         If TRUE, computer the distribution of time-at-risk and
#'                                       average absolute time between treatment and outcome. Note,
#'                                       may add significant computation time on some database
#'                                       engines. If set true in one analysis will default to true for all others.
#'
#' @export
createRunSelfControlledCohortArgs <- function(firstExposureOnly = TRUE,
                                              firstOutcomeOnly = TRUE,
                                              minAge = "",
                                              maxAge = "",
                                              studyStartDate = "",
                                              studyEndDate = "",
                                              addLengthOfExposureExposed = TRUE,
                                              riskWindowStartExposed = 1,
                                              riskWindowEndExposed = 30,
                                              addLengthOfExposureUnexposed = TRUE,
                                              riskWindowEndUnexposed = -1,
                                              riskWindowStartUnexposed = -30,
                                              hasFullTimeAtRisk = FALSE,
                                              washoutPeriod = 0,
                                              followupPeriod = 0,
                                              computeTarDistribution = FALSE) {
  # First: get default values:
  analysis <- list()
  for (name in names(formals(createRunSelfControlledCohortArgs))) {
    analysis[[name]] <- get(name)
  }
  # Second: overwrite defaults with actual values:
  values <- lapply(as.list(match.call())[-1], function(x) eval(x, envir = sys.frame(-3)))
  for (name in names(values)) {
    if (name %in% names(analysis))
      analysis[[name]] <- values[[name]]
  }
  class(analysis) <- "args"
  return(analysis)
}
OHDSI/SelfControlledCohort documentation built on Jan. 22, 2022, 10:55 a.m.