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

Description Usage Arguments Value Examples

View source: R/icd9toPheWAS.R

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

1
2
3
4
5
6
7
8
9
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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", 
                              replaceColumn   = TRUE, 
                              statistics      = TRUE 
                              )

EHRtemporalVariability documentation built on May 31, 2021, 5:07 p.m.