
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_037_1748639735> [?? 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 1 1988-10-27 1996-05-04
#> 2 3 5 1998-07-17 2013-01-18
#> 3 2 10 1934-12-14 1935-03-23
#> 4 1 9 1963-08-13 1970-04-09
#> 5 2 7 1937-10-22 1946-03-02
#> 6 2 3 1945-05-16 1961-03-14
#> 7 2 4 1974-08-23 1997-03-29
#> 8 3 6 1940-04-03 1944-10-09
#> 9 3 8 1942-10-21 1965-10-26
#> 10 3 2 1967-08-03 2002-09-10
#> # ℹ 1 more variable: acetaminophen_0_to_inf <dbl>
mockDisconnect(cdm = cdm)
# }