
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_005_1740755667> [?? 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 4 1986-02-27 2009-02-28
#> 2 1 5 1919-05-20 1920-12-31
#> 3 3 10 1950-10-08 1953-08-12
#> 4 1 9 1902-04-15 1902-11-26
#> 5 2 2 2010-06-01 2010-11-30
#> 6 1 7 1955-01-23 1962-07-24
#> 7 1 8 1946-08-05 1954-09-22
#> 8 3 6 1937-09-08 1940-06-06
#> 9 1 1 1933-02-11 1943-11-20
#> 10 2 3 1965-05-03 1969-05-28
#> # ℹ 3 more variables: cohort_3_0_to_inf <dbl>, cohort_2_0_to_inf <dbl>,
#> # cohort_1_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }