View source: R/addConceptIntersect.R
| addConceptIntersectFlag | R Documentation |
It creates column to indicate the flag overlap information between a table and a concept
addConceptIntersectFlag(
x,
conceptSet,
indexDate = "cohort_start_date",
censorDate = NULL,
window = list(c(0, Inf)),
targetStartDate = "event_start_date",
targetEndDate = "event_end_date",
inObservation = TRUE,
nameStyle = "{concept_name}_{window_name}",
name = NULL,
type = "numeric"
)
x |
A table containing individuals in a CDM reference. |
conceptSet |
A named list of concept sets. |
indexDate |
Name of a date column in |
censorDate |
Date or name of a date column in |
window |
Window or windows of time relative to |
targetStartDate |
Name or names of start-date columns in the target tables to use for the intersection. |
targetEndDate |
Name or names of end-date columns in the target tables
to use for the intersection. If |
inObservation |
If |
nameStyle |
Naming pattern for the added column or columns. It should
include the required formatting variables. If more than one |
name |
Name of the new table. If |
type |
Type of the created column(s). Counts, days, age, and observation
durations can be |
The original table (x) with one added column per intersection with the desired conceptSet in a specific window. One column will be created for each combination of window and conceptSet. The value of the column can either indicate presence (1 or TRUE), no intersection (0 or FALSE), or NA if the individual is not in observation at any time of the window. The representation depends on type.
library(PatientProfiles)
library(omopgenerics, warn.conflicts = TRUE)
library(dplyr, warn.conflicts = TRUE)
cdm <- mockPatientProfiles(source = "duckdb")
concept <- 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_
) |>
mutate(concept_name = paste0("concept: ", .data$concept_id))
cdm <- insertTable(cdm, "concept", concept)
cdm$cohort1 |>
addConceptIntersectFlag(conceptSet = list("acetaminophen" = 1125315))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.