
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_080_1748639748> [?? 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 2 9 1986-06-03 1987-05-19
#> 2 3 1 1951-08-26 1956-05-13
#> 3 3 8 1925-09-30 1927-05-09
#> 4 1 10 1908-01-02 1912-07-22
#> 5 3 3 1978-05-10 1978-07-25
#> 6 1 4 1939-02-18 1990-09-10
#> 7 2 6 1949-10-12 1952-10-15
#> 8 1 7 1971-06-07 1986-04-05
#> 9 1 2 1947-08-14 1983-01-04
#> 10 3 5 2000-06-19 2000-07-11
#> # ℹ 1 more variable: acetaminophen_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }