
Compute date of intersect with an omop table.
Source:R/addTableIntersect.R
      addTableIntersectDate.RdCompute date of intersect with an omop table.
Usage
addTableIntersectDate(
  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 |>
  addTableIntersectDate(tableName = "visit_occurrence")
#> # Source:   table<og_128_1759414379> [?? x 5]
#> # Database: DuckDB 1.4.0 [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         10 1903-07-10        1918-09-09     
#>  2                    1          5 1960-10-21        1970-06-03     
#>  3                    3          9 1933-05-06        1937-08-01     
#>  4                    3          4 1955-08-02        1961-09-10     
#>  5                    1          2 1936-10-13        1937-02-15     
#>  6                    3          8 1973-12-09        1975-07-28     
#>  7                    2          7 1972-03-01        1973-11-30     
#>  8                    3          1 1976-05-03        1978-01-27     
#>  9                    1          3 1920-02-21        1930-04-23     
#> 10                    1          6 1931-07-23        1931-12-03     
#> # ℹ 1 more variable: visit_occurrence_0_to_inf <date>
# }