
It creates column to indicate the flag overlap information between a table and a concept
Source:R/addConceptIntersect.R
addConceptIntersectFlag.Rd
It creates column to indicate the flag overlap information between a table and a concept
Arguments
- x
Table with individuals in the cdm.
- conceptSet
Concept set list.
- indexDate
Variable in x that contains the date to compute the intersection.
- censorDate
whether to censor overlap events at a date column of x
- window
window to consider events in.
- targetStartDate
Event start date to use for the intersection.
- targetEndDate
Event end date to use for the intersection.
- 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()
concept <- dplyr::tibble(
concept_id = c(1125315),
domain_id = "Drug",
vocabulary_id = NA_character_,
concept_class_id = "Ingredient",
standard_concept = "S",
concept_code = NA_character_,
valid_start_date = as.Date("1900-01-01"),
valid_end_date = as.Date("2099-01-01"),
invalid_reason = NA_character_
) |>
dplyr::mutate(concept_name = paste0("concept: ", .data$concept_id))
cdm <- CDMConnector::insertTable(cdm, "concept", concept)
cdm$cohort1 |>
addConceptIntersectFlag(conceptSet = list("acetaminophen" = 1125315))
#> Warning: ! `codelist` casted to integers.
#> # Source: table<og_082_1751196061> [?? x 5]
#> # Database: DuckDB v1.3.1 [unknown@Linux 6.11.0-1015-azure:R 4.5.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 2 2 1916-01-01 1936-02-18
#> 2 2 3 1906-01-21 1916-06-29
#> 3 1 4 1937-07-21 1940-10-11
#> 4 1 7 1934-11-06 1940-05-06
#> 5 3 5 1953-03-27 1986-11-03
#> 6 2 9 1945-05-09 1955-11-24
#> 7 1 6 1972-05-14 1975-05-25
#> 8 2 10 1944-10-15 1949-07-15
#> 9 2 8 1947-12-26 1968-03-18
#> 10 2 1 2030-01-04 2031-09-23
#> # ℹ 1 more variable: acetaminophen_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }