stratifyByDomain: Stratify a codelist by domain category.

View source: R/stratifyByDomain.R

stratifyByDomainR Documentation

Stratify a codelist by domain category.

Description

Stratify a codelist by domain category.

Usage

stratifyByDomain(
  x,
  cdm,
  nameStyle = "{codelist_name}_{domain}",
  keepOriginal = FALSE
)

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).

Value

The codelist with the required stratifications, as different elements of the list.

Examples


library(CodelistGenerator)
library(omopgenerics)
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



CodelistGenerator documentation built on Dec. 17, 2025, 5:06 p.m.