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

View source: R/subsetOnDoseForm.R

subsetOnDoseFormR Documentation

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)

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.

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

Examples


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)



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