Learn R Programming

CodelistGenerator (version 4.0.0)

stratifyByDoseUnit: Stratify a codelist by dose unit.

Description

Stratify a codelist by dose unit.

Usage

stratifyByDoseUnit(
  x,
  cdm,
  nameStyle = "{codelist_name}_{dose_unit}",
  keepOriginal = FALSE
)

Value

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

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 {dose_unit} to include the dose unit name.

keepOriginal

Whether to keep the original codelist (TRUE) or just return the stratified ones (FALSE).

Examples

Run this code
# \donttest{
library(CodelistGenerator)

cdm <- mockVocabRef()

codes <- newCodelist(list("concepts" = c(20L, 21L)))
new_codes <- stratifyByDoseUnit(x = codes,
                                cdm = cdm,
                                keepOriginal = TRUE)
new_codes
# }

Run the code above in your browser using DataLab