
It creates columns to indicate number of occurrences of intersection with a cohort
Source:R/addCohortIntersect.R
addCohortIntersectCount.Rd
It creates columns to indicate number of occurrences of intersection with a cohort
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 |>
addCohortIntersectCount(
targetCohortTable = "cohort2"
)
#> # Source: table<og_004_1751196035> [?? x 7]
#> # Database: DuckDB v1.3.1 [unknown@Linux 6.11.0-1015-azure:R 4.5.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 2 6 1980-09-12 2005-08-18
#> 2 3 10 1975-11-09 1977-04-11
#> 3 3 7 1983-04-18 2002-06-23
#> 4 1 8 1930-02-14 1942-04-25
#> 5 1 9 1953-11-05 1954-04-24
#> 6 1 3 1969-10-19 1977-08-26
#> 7 2 5 1923-06-04 1940-05-22
#> 8 1 2 1993-09-24 1993-12-02
#> 9 3 4 1970-08-12 1971-09-07
#> 10 3 1 1978-12-03 1982-05-08
#> # ℹ 3 more variables: cohort_2_0_to_inf <dbl>, cohort_1_0_to_inf <dbl>,
#> # cohort_3_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }