powered by
This is a preprocessing step to standardize the icd codes to have decimals.
add_decimal(df, icd_cols, places = 3)
A dataframe in wide format where each row represents a unique identifier (ID), and each column contains a variable associated with that ID.
The dataframe to be converted.
A character vector specifying the names of the columns containing ICD codes.
An numeric value specifying the number of decimal places. Default is 3 decimal places.
df <- data.frame( id = c(1, 2, 3), icd_1 = c("C509", "D633", "I210"), icd_2 = c("D509", "E788", "N183") ) add_decimal(df, icd_cols = c("icd_1", "icd_2"), places = 3)
Run the code above in your browser using DataLab