Compute time to intersect with an omop table.
Source:R/addTableIntersect.R
addTableIntersectDays.Rd
Compute 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),
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 %>%
addTableIntersectDays(tableName = "visit_occurrence")
#> # Source: table<og_139_1715898473> [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 3 8 2045-12-07 2052-10-21
#> 2 3 3 1930-09-01 1947-02-08
#> 3 1 10 2020-10-31 2032-08-23
#> 4 1 2 1992-01-31 1994-05-20
#> 5 2 5 1992-12-01 2011-04-15
#> 6 1 1 1987-05-06 2066-02-13
#> 7 3 9 2042-01-22 2088-10-28
#> 8 3 6 1962-04-25 1989-12-29
#> 9 1 4 2021-03-18 2028-01-31
#> 10 2 7 2040-12-23 2053-10-01
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }