
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),
inObservation = TRUE,
order = "first",
nameStyle = "{table_name}_{window_name}",
name = NULL
)
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, episode.
- 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.
- inObservation
If TRUE only records inside an observation period will be considered.
- 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.
- name
Name of the new table, if NULL a temporary table is returned.
Examples
# \donttest{
cdm <- mockPatientProfiles()
cdm$cohort1 |>
addTableIntersectDate(tableName = "visit_occurrence")
#> # Source: table<og_130_1741347163> [?? x 5]
#> # Database: DuckDB v1.2.0 [unknown@Linux 6.8.0-1021-azure:R 4.4.3/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 2 9 1968-10-17 1982-02-13
#> 2 2 8 1910-03-08 1917-07-05
#> 3 3 2 1958-02-01 1983-09-17
#> 4 3 6 1979-08-27 1995-04-09
#> 5 1 5 1968-09-22 1974-01-27
#> 6 1 10 1928-07-23 1929-05-25
#> 7 1 7 1923-04-10 1930-01-12
#> 8 2 1 1987-07-30 2016-08-17
#> 9 3 4 2021-12-17 2022-09-06
#> 10 2 3 1966-09-10 1971-06-27
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <date>
mockDisconnect(cdm = cdm)
# }