merge_icd9_dx_and_procs: Merge ICD-9-CM diagnostic and procedure codes

Description Usage Arguments Value Examples

View source: R/icd9cm.R

Description

Merges a dataframe containing ICD-9-CM diagostic codes with a dataframe containing ICD-9 procedure codes Diagnostic codes are prefixed with 'D', while procedure codes are prefixed with 'P'

Usage

1
2
3
4
5
6
merge_icd9_dx_and_procs(
  dx_df,
  proc_df,
  icd9dxvar = "icd9cm",
  icd9pvar = "icd9cm"
)

Arguments

dx_df

a data frame with at least two columns, specified as idvar and icd9dxvar, where the values are ICD-9 diagnostic codes

proc_df

a data frame with at least two columns, specified as idvar and icd9pvar, where the values are ICD-9 procedure codes

icd9dxvar

name of icd9 diagnostic code column, default "icd9cm"

icd9pvar

name of icd9 procedure code column, default "icd9cm"

Value

a merged dataframe with common columns and "icd9cm"

Examples

1
2
3
4
5
6
7
cases <- data.frame(id=c(1,2),
                    icd9dxlist=c('162.4,070.30,155.0,401.9','996.52,E878.8,V45.86'),
                    icd9plist=c('38.16','38.42'),
                    stringsAsFactors=TRUE)
dx_df <- melt_icd9list(cases, "id", "icd9dxlist")
proc_df <- melt_icd9list(cases, "id", "icd9plist")
merge_icd9_dx_and_procs(dx_df, proc_df)

medicalrisk documentation built on March 26, 2020, 6:31 p.m.