
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{
library(PatientProfiles)
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
addTableIntersectDays(tableName = "visit_occurrence")
#> # Source: table<og_133_1757798575> [?? x 5]
#> # Database: DuckDB 1.3.3-dev231 [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 1 5 1963-10-31 1966-01-06
#> 2 2 3 1977-12-14 1992-04-08
#> 3 1 2 1922-02-22 1936-07-30
#> 4 3 7 1954-01-11 1960-04-01
#> 5 2 6 1991-10-30 1991-12-03
#> 6 2 1 1992-06-13 2006-11-16
#> 7 2 8 1942-02-20 1942-04-01
#> 8 2 4 1988-07-11 1988-12-26
#> 9 2 9 2000-11-23 2005-06-11
#> 10 3 10 1933-02-01 1943-09-25
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <dbl>
# }