Compute date of intersect with an omop table.
Source:R/addTableIntersect.R
addTableIntersectDate.Rd
Compute date of intersect with an omop table.
Usage
addTableIntersectDate(
x,
tableName,
indexDate = "cohort_start_date",
censorDate = NULL,
window = list(c(0, Inf)),
targetDate = startDateColumn(tableName),
order = "first",
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.
- targetDate
Target date in tableName.
- order
which record is considered in case of multiple records (only required for date and days options).
- nameStyle
naming of the added column or columns, should include required parameters.
Examples
# \donttest{
cdm <- mockPatientProfiles()
cdm$cohort1 %>%
addTableIntersectDate(tableName = "visit_occurrence")
#> # Source: table<og_132_1715898470> [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 2 2005-10-02 2080-01-01
#> 2 1 10 1982-06-08 2070-07-03
#> 3 3 9 2039-05-27 2066-11-09
#> 4 3 1 1986-01-12 2042-11-29
#> 5 3 4 2055-01-14 2056-06-27
#> 6 2 3 2075-03-27 2134-07-24
#> 7 3 7 1948-02-25 1958-06-07
#> 8 2 6 1927-06-29 1982-05-28
#> 9 1 5 1985-01-15 2004-02-12
#> 10 1 8 2025-04-17 2074-04-16
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <date>
mockDisconnect(cdm = cdm)
# }