addCohortIntersectDate: Date of cohorts that are present in a certain window

View source: R/addCohortIntersect.R

addCohortIntersectDateR Documentation

Date of cohorts that are present in a certain window

Description

Date of cohorts that are present in a certain window

Usage

addCohortIntersectDate(
  x,
  targetCohortTable,
  targetCohortId = NULL,
  indexDate = "cohort_start_date",
  censorDate = NULL,
  targetDate = "cohort_start_date",
  order = "first",
  window = c(0, Inf),
  nameStyle = "{cohort_name}_{window_name}",
  name = NULL
)

Arguments

x

Table with individuals in the cdm.

targetCohortTable

Cohort table to.

targetCohortId

Cohort IDs of interest from the other cohort table. If NULL, all cohorts will be used with a time variable added for each cohort of interest.

indexDate

Variable in x that contains the date to compute the intersection.

censorDate

whether to censor overlap events at a specific date or a column date of x.

targetDate

Date of interest in the other cohort table. Either cohort_start_date or cohort_end_date.

order

date to use if there are multiple records for an individual during the window of interest. Either first or last.

window

Window of time to identify records relative to the indexDate. Records outside of this time period will be ignored.

nameStyle

naming of the added column or columns, should include required parameters.

name

Name of the new table, if NULL a temporary table is returned.

Value

x along with additional columns for each cohort of interest.

Examples


cdm <- mockPatientProfiles()

cdm$cohort1 %>%
  addCohortIntersectDate(
    targetCohortTable = "cohort2"
  )
mockDisconnect(cdm = cdm)



PatientProfiles documentation built on Oct. 30, 2024, 9:13 a.m.