
Compute time to intersect with an omop table.
Source:R/addTableIntersect.R
addTableIntersectDays.RdCompute time to intersect with an omop table.
Usage
addTableIntersectDays(
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{
library(PatientProfiles)
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
addTableIntersectDays(tableName = "visit_occurrence")
#> # Source: table<og_142_1761733721> [?? x 5]
#> # Database: DuckDB 1.4.1 [unknown@Linux 6.11.0-1018-azure:R 4.5.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 2 6 1941-01-13 1945-02-18
#> 2 1 7 1979-03-08 1983-03-17
#> 3 3 5 1983-09-06 2009-01-31
#> 4 3 8 1926-11-21 1932-01-26
#> 5 2 3 1962-07-07 1963-11-08
#> 6 3 2 1973-09-05 1974-10-26
#> 7 3 1 1948-05-12 1949-11-02
#> 8 2 10 1999-09-27 2005-05-13
#> 9 1 4 1938-01-16 1938-07-14
#> 10 1 9 1952-12-10 1967-02-28
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <dbl>
# }