
Stratify a codelist by domain category.
stratifyByDomain.RdStratify a codelist by domain category.
Arguments
- x
A codelist.
- cdm
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on).
- nameStyle
Naming of the new codelists, use
{codelist_name}to include the codelist name and{domain}to include the domain name.- keepOriginal
Whether to keep the original codelist (TRUE) or just return the stratified ones (FALSE).
Examples
# \donttest{
library(CodelistGenerator)
library(omopgenerics)
#>
#> Attaching package: ‘omopgenerics’
#> The following object is masked from ‘package:stats’:
#>
#> filter
cdm <- mockVocabRef()
codes <- newCodelist(list("concepts_1" = c(20L,21L,22L),
"concepts_2" = c(10L,13L,21L)))
new_codes <- stratifyByDomain(x = codes,
cdm = cdm,
keepOriginal = TRUE)
new_codes
#>
#> ── 5 codelists ─────────────────────────────────────────────────────────────────
#>
#> - concepts_1 (3 codes)
#> - concepts_1_drug (2 codes)
#> - concepts_1_unit (1 codes)
#> - concepts_2 (3 codes)
#> - concepts_2_drug (3 codes)
# }