Learn R Programming

icdcomorbid (version 1.0.0)

add_decimal: Insert decimals to the ICD codes

Description

This is a preprocessing step to standardize the icd codes to have decimals.

Usage

add_decimal(df, icd_cols, places = 3)

Value

A dataframe in wide format where each row represents a unique identifier (ID), and each column contains a variable associated with that ID.

Arguments

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.

Examples

Run this code
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