Learn R Programming

CodelistGenerator (version 4.0.0)

subsetOnDoseForm: Subset a codelist to only those codes from a particular domain.

Description

Subset a codelist to only those codes from a particular domain.

Usage

subsetOnDoseForm(x, cdm, doseForm, negate = FALSE)

Value

The codelist with only those concepts associated with the dose form (if negate = FALSE) or the codelist without those concepts associated with the dose form (if negate = TRUE).

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

doseForm

Dose form/s. See availableDoseForms() to explore available dose forms in your codelist.

negate

If FALSE, only concepts with the dose form specified will be returned. If TRUE, concepts with the dose form specified will be excluded.

Examples

Run this code
# \donttest{
library(CodelistGenerator)
library(omopgenerics)
cdm <- mockVocabRef()

codelist <- newCodelist(list("codes" = c(10L,20L,21L)))

# Dose forms present in our codelist:
codelist |> associatedDoseForms(cdm)

codes <- subsetOnDoseForm(
              x = codelist,
              cdm = cdm,
              doseForm = "Injection")
codes

codes |> associatedDoseForms(cdm)
# }

Run the code above in your browser using DataLab