
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_029_1740755676> [?? x 7]
#> # Database: DuckDB v1.2.0 [unknown@Linux 6.8.0-1021-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 2 1936-02-19 1944-06-29
#> 2 1 7 1935-06-28 1937-05-15
#> 3 1 4 1999-07-06 2022-06-13
#> 4 1 1 1928-07-27 1932-06-03
#> 5 1 10 1961-04-11 1967-10-16
#> 6 1 9 1961-02-02 1976-07-01
#> 7 1 5 1972-08-09 1982-08-20
#> 8 2 6 1979-03-21 1981-01-08
#> 9 2 8 1959-12-01 1965-02-04
#> 10 1 3 1966-06-20 1971-02-28
#> # ℹ 3 more variables: cohort_1_0_to_inf <dbl>, cohort_2_0_to_inf <dbl>,
#> # cohort_3_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }