add_decimal {icdcomorbid} | R Documentation |
This is a preprocessing step to standardize the icd codes to have decimals.
add_decimal(df, icd_cols, places = 3)
df |
The dataframe to be converted. |
icd_cols |
A character vector specifying the names of the columns containing ICD codes. |
places |
An numeric value specifying the number of decimal places. Default is 3 decimal places. |
A dataframe in wide format where each row represents a unique identifier (ID), and each column contains a variable associated with that ID.
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)