
Generate a codelist from the intersection of different codelists. The generated codelist will come out in alphabetical order.
intersectCodelists.RdGenerate a codelist from the intersection of different codelists. The generated codelist will come out in alphabetical order.
Examples
# \donttest{
library(CodelistGenerator)
library(omock)
# Create a CDM object
cdm <- mockCdmReference()
# Intersect two codelists
codelist <- newCodelist(list("mood" = c(37110496L, 4226696L, 4304866L),
"manic" = c(37110496L, 4226696L)))
intersectCodelists(codelist, keepOriginal = TRUE)
#>
#> ── 3 codelists ─────────────────────────────────────────────────────────────────
#>
#> - intersection_manic_mood (2 codes)
#> - manic (2 codes)
#> - mood (3 codes)
# Intersect two codelists_with_details
codelist <- asCodelistWithDetails(codelist, cdm)
intersectCodelists(codelist, keepOriginal = FALSE)
#>
#> ── 1 codelist with details ─────────────────────────────────────────────────────
#>
#> - intersection_manic_mood (2 codes)
# }