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` contains numeric values, they are casted to integers.
#> # Source: table<og_045_1734613797> [?? x 5]
#> # Database: DuckDB v1.1.3 [unknown@Linux 6.8.0-1017-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 8 1947-04-05 1963-12-09
#> 2 3 3 1978-03-12 2004-08-10
#> 3 3 10 1948-06-03 1948-06-15
#> 4 2 2 1928-08-04 1931-10-26
#> 5 2 5 1915-02-28 1923-06-06
#> 6 1 6 1924-09-21 1931-05-01
#> 7 2 9 1914-10-01 1926-03-23
#> 8 2 7 1997-11-09 1998-11-12
#> 9 2 1 1917-11-19 1942-07-09
#> 10 1 4 1997-06-13 1999-04-12
#> # ℹ 1 more variable: acetaminophen_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }