
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_118_1748639793> [?? 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 1 2 1931-06-04 1957-06-18
#> 2 2 6 1959-07-16 1971-03-16
#> 3 3 9 1947-08-25 1950-07-31
#> 4 2 10 1965-05-22 1967-01-18
#> 5 1 1 1974-03-14 1976-11-20
#> 6 2 5 1953-03-14 1957-11-19
#> 7 2 7 1976-04-24 1976-06-06
#> 8 3 4 1982-06-17 1983-02-22
#> 9 3 8 1967-12-11 1970-06-09
#> 10 3 3 1975-06-26 1976-08-16
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }