
Compute number of intersect with an omop table.
Source:R/addTableIntersect.R
addTableIntersectCount.Rd
Compute number of intersect with an omop table.
Usage
addTableIntersectCount(
x,
tableName,
indexDate = "cohort_start_date",
censorDate = NULL,
window = list(c(0, Inf)),
targetStartDate = startDateColumn(tableName),
targetEndDate = endDateColumn(tableName),
inObservation = TRUE,
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.
- targetStartDate
Column name with start date for comparison.
- targetEndDate
Column name with end date for comparison.
- inObservation
If TRUE only records inside an observation period will be considered.
- 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 |>
addTableIntersectCount(tableName = "visit_occurrence")
#> # Source: table<og_123_1740755733> [?? x 5]
#> # Database: DuckDB v1.2.0 [unknown@Linux 6.8.0-1021-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 2 1946-02-02 1948-06-28
#> 2 3 6 1965-04-21 1965-11-08
#> 3 2 8 1906-04-14 1908-02-09
#> 4 2 5 1973-01-04 1978-04-28
#> 5 2 9 2001-01-07 2001-10-06
#> 6 1 7 1924-08-24 1928-11-02
#> 7 2 1 1924-11-16 1926-12-23
#> 8 3 3 2006-10-24 2026-08-23
#> 9 2 10 1938-01-25 1944-05-27
#> 10 1 4 1920-10-16 1934-01-18
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }