EHRtemporalVariability (version 1.0.4)

icd9toPheWAS: Function to transform ICD9-CM codification into PheWAS code

Description

Given a data.frame object with a column of ICD9-CM codes, it generates a new data.frame object with the ICD9-CM codes transformed into PheWAS codes.

Usage

icd9toPheWAS(
  data,
  icd9ColumnName,
  missingValues = "NA",
  phecodeDescription = FALSE,
  statistics = FALSE,
  replaceColumn = TRUE,
  verbose = FALSE
)

Arguments

data

A data.frame object with at least one column of ICD9-CM codes that one to be transformed into a PheWAS code.

icd9ColumnName

The name of the column containing the ICD9-CM.

missingValues

The value used to determine missing values in the data.frame.

phecodeDescription

By default FALSE. Change it to TRUE to map to the PheWAS code description instead to the PheWAS numeric code.

statistics

By default FALSE. Change it to TRUE to show the summary of the mapping like the percentage of initial ICD9-CM codes mapped to PheWAS code.

replaceColumn

By default TRUE. Change it to FALSE in order to create a new column with the PheWAS code maintaining the ICD9-CM code.

verbose

By default FALSE. Change it to TRUE to get an on-time log from the function.

Value

An object of class data.frame with the ICD9-CM column transform into PheWAS codes.

Examples

Run this code
# NOT RUN {
dataset <- read.csv2(system.file("extdata",
                                   "nhdsSubset.csv",
                                   package="EHRtemporalVariability"), 
                     sep  = ",",
                     header = TRUE, 
                     na.strings = "", 
                     colClasses = c( "character", "numeric", "factor",
                                     "numeric" , rep( "factor", 22 ) ) )

datasetPheWAS <- icd9toPheWAS( data           = dataset,
                              icd9ColumnName  = "diagcode1", 
                              missingValues   = "N/A", 
                              statistics      = TRUE 
                              )
# }

Run the code above in your browser using DataCamp Workspace