
It creates column to indicate the count overlap information between a table and a concept
Source:R/addConceptIntersect.R
addConceptIntersectCount.Rd
It creates column to indicate the count 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 |>
addConceptIntersectCount(conceptSet = list("acetaminophen" = 1125315))
#> Warning: ! `codelist` casted to integers.
#> # Source: table<og_040_1740755681> [?? x 5]
#> # Database: DuckDB v1.2.0 [unknown@Linux 6.8.0-1021-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 2 9 1948-07-10 1958-01-15
#> 2 3 5 1983-09-16 1987-11-10
#> 3 2 2 1923-01-12 1936-07-13
#> 4 2 3 2023-05-18 2039-02-03
#> 5 2 1 1961-07-28 1962-09-13
#> 6 3 7 1918-07-19 1926-08-11
#> 7 3 6 1949-08-30 1967-03-10
#> 8 1 10 1961-01-23 1976-08-20
#> 9 2 8 1951-02-10 1963-07-12
#> 10 2 4 1933-04-12 1954-01-21
#> # ℹ 1 more variable: acetaminophen_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }