
Compute number of intersect with an omop table.
Source:R/addTableIntersect.R
addTableIntersectCount.RdCompute 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_128_1761733715> [?? x 5]
#> # Database: DuckDB 1.4.1 [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 3 7 1953-12-11 1959-11-13
#> 2 3 4 1922-12-04 1927-08-24
#> 3 1 3 1975-06-16 1982-07-04
#> 4 1 8 1915-08-20 1917-11-04
#> 5 2 9 1923-07-07 1926-11-24
#> 6 2 10 1903-08-25 1919-09-04
#> 7 3 1 1981-05-03 1981-05-23
#> 8 3 2 1945-04-12 1951-10-24
#> 9 3 5 1982-04-27 1983-12-20
#> 10 2 6 1963-08-23 1965-01-31
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <dbl>
# }