restrictToCodesInUse: Filter a codelist to keep only the codes used in the database

View source: R/codesInUse.R

restrictToCodesInUseR Documentation

Filter a codelist to keep only the codes used in the database

Description

Filter a codelist to keep only the codes used in the database

Usage

restrictToCodesInUse(
  x,
  cdm,
  table = c("condition_occurrence", "device_exposure", "drug_exposure", "measurement",
    "observation", "procedure_occurrence", "visit_occurrence")
)

Arguments

x

A codelist

cdm

cdm_reference via CDMConnector

table

cdm table

Value

A list of integers indicating the codes used in the database

Examples

## Not run: 
cdm <- mockVocabRef("database")
codes <- getCandidateCodes(cdm = cdm,
                           keywords = "arthritis",
                           domains = "Condition",
                           includeDescendants = FALSE)
x <- restrictToCodesInUse(list("cs1" = codes$concept_id,
                               "cs2" = 999),
                                cdm = cdm)

x
CDMConnector::cdmDisconnect(cdm)

## End(Not run)

oxford-pharmacoepi/CodelistGenerator documentation built on April 12, 2024, 9:30 a.m.