Compute number of intersect with an omop table.
Source:R/addTableIntersect.R
addTableIntersectCount.Rd
Compute number of intersect with an omop table.
Usage
addTableIntersectCount(
x,
tableName,
indexDate = "cohort_start_date",
censorDate = NULL,
window = list(c(0, Inf)),
targetStartDate = startDateColumn(tableName),
targetEndDate = endDateColumn(tableName),
nameStyle = "{table_name}_{window_name}"
)
Arguments
- x
Table with individuals in the cdm.
- tableName
Name of the table to intersect with. Options: visit_occurrence, condition_occurrence, drug_exposure, procedure_occurrence, device_exposure, measurement, observation, drug_era, condition_era, specimen.
- 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.
- window
window to consider events in.
- targetStartDate
Column name with start date for comparison.
- targetEndDate
Column name with end date for comparison.
- nameStyle
naming of the added column or columns, should include required parameters.
Examples
# \donttest{
cdm <- mockPatientProfiles()
cdm$cohort1 %>%
addTableIntersectCount(tableName = "visit_occurrence")
#> # Source: table<og_125_1715898467> [10 x 5]
#> # Database: DuckDB v0.10.2 [unknown@Linux 6.5.0-1021-azure:R 4.4.0/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 5 1931-07-18 1992-02-15
#> 2 2 3 1950-05-13 1980-03-06
#> 3 1 7 2025-07-03 2039-10-15
#> 4 2 9 1993-04-27 2002-01-27
#> 5 2 8 2044-11-26 2083-01-28
#> 6 1 10 2035-02-15 2059-04-29
#> 7 1 4 1957-06-12 1977-11-17
#> 8 3 1 2028-06-25 2031-01-03
#> 9 2 2 2023-05-14 2096-01-18
#> 10 1 6 2059-05-30 2090-01-23
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }