addConceptName: Add concept name for each concept_id

View source: R/utilities.R

addConceptNameR Documentation

Add concept name for each concept_id

Description

Add concept name for each concept_id

Usage

addConceptName(table, column = NULL, nameStyle = "{column}_name")

Arguments

table

cdm_table that contains column.

column

Column to add the concept names from. If NULL any column that its name ends with 'concept_id' will be used.

nameStyle

Name of the new column.

Value

table with an extra column with the concept names.

Examples


library(PatientProfiles)
library(duckdb)
library(CDMConnector)
library(dplyr, warn.conflicts = FALSE)

dbName <- "GiBleed"
requireEunomia(datasetName = dbName)
con <- dbConnect(drv = duckdb(dbdir = eunomiaDir(datasetName = dbName)))
cdm <- cdmFromCon(con = con, cdmSchema = "main", writeSchema = "main")

cdm$drug_exposure |>
  addConceptName(column = "drug_concept_id", nameStyle = "drug_name") |>
  glimpse()

cdm$drug_exposure |>
  addConceptName() |>
  glimpse()



PatientProfiles documentation built on June 8, 2025, 11:25 a.m.