Learn R Programming

CodelistGenerator (version 3.5.0)

subsetToCodesInUse: Filter a codelist to keep only the codes being used in patient records

Description

Filter a codelist to keep only the codes being used in patient records

Usage

subsetToCodesInUse(
  x,
  cdm,
  minimumCount = 0L,
  table = c("condition_occurrence", "device_exposure", "drug_exposure", "measurement",
    "observation", "procedure_occurrence", "visit_occurrence")
)

Value

The filtered codelist with only the codes used in the database

Arguments

x

A codelist.

cdm

A cdm reference via CDMConnector.

minimumCount

Any codes with a frequency under this will be removed.

table

cdm table of interest.

Examples

Run this code
# \donttest{
cdm <- mockVocabRef("database")
codes <- getCandidateCodes(cdm = cdm,
                           keywords = "arthritis",
                           domains = "Condition",
                           includeDescendants = FALSE)
x <- subsetToCodesInUse(list("cs1" = codes$concept_id,
                               "cs2" = 999),
                                cdm = cdm)

x
CDMConnector::cdmDisconnect(cdm)
# }

Run the code above in your browser using DataLab