
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),
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 |>
addTableIntersectDays(tableName = "visit_occurrence")
#> # Source: table<og_131_1748639798> [?? 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 1 1944-05-19 1948-01-30
#> 2 1 9 1944-07-27 1955-11-17
#> 3 3 10 1949-01-26 1950-09-14
#> 4 1 7 1969-08-16 1970-12-29
#> 5 1 5 1939-09-29 1947-07-13
#> 6 1 3 1975-11-16 1977-02-24
#> 7 2 4 1965-06-08 1965-08-28
#> 8 2 6 1940-10-13 1944-04-15
#> 9 1 8 1915-02-18 1925-06-19
#> 10 1 2 1948-10-21 1950-05-18
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }