
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{
library(PatientProfiles)
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
addTableIntersectCount(tableName = "visit_occurrence")
#> # Source: table<og_120_1757798568> [?? 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 2 10 1944-08-25 1949-10-04
#> 2 1 3 1993-05-14 1999-08-17
#> 3 2 8 1980-01-03 2012-07-18
#> 4 3 9 1938-09-20 1952-05-29
#> 5 1 4 1921-06-09 1928-11-17
#> 6 3 2 1983-08-19 1986-02-17
#> 7 3 7 1958-07-22 1987-04-19
#> 8 1 1 1944-12-21 1946-02-18
#> 9 1 5 1920-10-12 1930-05-01
#> 10 3 6 1970-06-15 1971-09-04
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <dbl>
# }