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}",
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.
- 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_145_1734613855> [?? x 5]
#> # Database: DuckDB v1.1.3 [unknown@Linux 6.8.0-1017-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 3 1971-07-28 1990-03-18
#> 2 2 5 1950-05-02 1955-12-29
#> 3 1 8 1953-04-23 1957-02-13
#> 4 1 10 1922-12-18 1932-01-30
#> 5 2 7 1964-10-03 1966-09-03
#> 6 1 1 1948-10-15 1950-02-18
#> 7 3 2 1946-09-21 1963-06-21
#> 8 1 6 1931-12-19 1943-01-30
#> 9 1 9 1920-12-23 1921-07-20
#> 10 1 4 1945-02-03 1947-10-08
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <date>
mockDisconnect(cdm = cdm)
# }