% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/stratifyByDomain.R
\name{stratifyByDomain}
\alias{stratifyByDomain}
\title{Stratify a codelist by domain category.}
\usage{
stratifyByDomain(
  x,
  cdm,
  nameStyle = "{codelist_name}_{domain}",
  keepOriginal = FALSE
)
}
\arguments{
\item{x}{A codelist, codelist_with_details, or a concept_set. See \code{newCodelist()}, \code{newCodelistWithDetails()}, \code{newConceptSetExpression()} functions for more details.}

\item{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).}

\item{nameStyle}{Naming of the new codelists, use \code{{codelist_name}} to
include the codelist name and \code{{domain}} to include the domain name.}

\item{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.
}
\description{
Stratify a codelist by domain category.
}
\examples{
\donttest{
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
}

}
