
It creates columns to indicate the presence of cohorts
Source:R/addCohortIntersect.R
addCohortIntersectFlag.Rd
It creates columns to indicate the presence of cohorts
Arguments
- x
Table with individuals in the cdm.
- targetCohortTable
name of the cohort that we want to check for overlap.
- targetCohortId
vector of cohort definition ids to include.
- 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.
- targetStartDate
date of reference in cohort table, either for start (in overlap) or on its own (for incidence).
- targetEndDate
date of reference in cohort table, either for end (overlap) or NULL (if incidence).
- window
window to consider events of.
- 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.
Examples
# \donttest{
cdm <- mockPatientProfiles()
cdm$cohort1 |>
addCohortIntersectFlag(
targetCohortTable = "cohort2"
)
#> # Source: table<og_025_1748639729> [?? x 7]
#> # Database: DuckDB v1.2.2 [unknown@Linux 6.11.0-1015-azure:R 4.5.0/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 2 1950-07-22 1974-09-12
#> 2 2 7 1972-03-14 1999-04-22
#> 3 3 3 1916-06-06 1928-02-25
#> 4 1 8 1919-08-14 1944-12-24
#> 5 1 4 1921-09-17 1929-04-06
#> 6 1 6 1941-01-06 1942-10-23
#> 7 3 5 1978-05-30 1981-07-03
#> 8 3 10 1934-01-05 1943-07-16
#> 9 2 1 1937-12-16 1940-12-11
#> 10 1 9 1917-06-30 1918-08-05
#> # ℹ 3 more variables: cohort_3_0_to_inf <dbl>, cohort_2_0_to_inf <dbl>,
#> # cohort_1_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }