
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_126_1748639796> [?? x 5]
#> # Database: DuckDB v1.2.2 [unknown@Linux 6.11.0-1015-azure:R 4.5.0/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 9 1940-12-08 1950-11-13
#> 2 3 5 1985-01-11 1990-11-14
#> 3 3 2 1933-03-05 1934-06-18
#> 4 1 1 1979-02-23 1981-11-02
#> 5 2 4 2013-03-07 2015-03-04
#> 6 3 6 1929-08-28 1936-05-09
#> 7 3 8 1987-01-20 1987-02-16
#> 8 2 10 1969-06-19 1970-04-23
#> 9 3 7 2015-04-28 2018-07-12
#> 10 2 3 1986-09-11 1987-03-31
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <date>
mockDisconnect(cdm = cdm)
# }