Introduction to epocakir

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.height = 4,
  fig.width = 7
)

Introduction

The epocakir package makes clinical coding of patients with kidney disease using clinical practice guidelines easy. The guidelines used are the evidence-based KDIGO guidelines. This package covers acute kidney injury (AKI), anemia, and chronic liver disease(CKD).

Features

Examples

library(epocakir)
library(dplyr)
library(units)

Clinical Data

Often clinical data must be cleansed and tidied before analysis can begin. To assist in this, several utility functions have been included. To explore these, consider a sample clinical dataset clinical_obvs:

# Example workflow: clinical_obvs <- read.csv("cohort.csv")
glimpse(clinical_obvs)

tidy_obvs <- clinical_obvs %>%
  combine_date_time_cols() %>%
  mutate(
    Age = dob2age(`Date of Birth`),
    Height = as_metric(height = set_units(as.numeric(Height), "cm"))
  ) %>%
  binary2factor(Male, Surgery)

glimpse(tidy_obvs)

Make sure to use set_units() from the units package to convert all measurements into unit objects for automatic unit conversion in epocakir.

AKI Staging

Next consider the sample aki_pt_data dataset. It is possible to use aki_staging() to automatically classify the presence and staging of AKI. If a particular method is required, it is possible to classify AKI using aki_bCr(), aki_SCr() or aki_UO().

# Example workflow: aki_pt_data <- read.csv("aki.csv")
head(aki_pt_data)

aki_staging(aki_pt_data,
  SCr = "SCr_", bCr = "bCr_", UO = "UO_",
  dttm = "dttm_", pt_id = "pt_id_"
)

aki_pt_data %>%
  mutate(aki = aki_staging(
    SCr = SCr_, bCr = bCr_, UO = UO_,
    dttm = dttm_, pt_id = pt_id_
  )) %>%
  select(pt_id_, SCr_:dttm_, aki)

aki_pt_data %>%
  mutate(aki = aki_SCr(
    SCr = SCr_, dttm = dttm_, pt_id = pt_id_
  )) %>%
  select(pt_id_, SCr_:dttm_, aki)

Estimated Glomerular Filtration Rate

Similarly, eGFR() offers the ability to automatically select the appropriate formula to estimate the glomerular filtration rate. If a particular formula is required, then eGFR_adult_SCr, eGFR_adult_SCysC, eGFR_adult_SCr_SCysC, eGFR_child_SCr, eGFR_child_SCr_BUN, or eGFR_child_SCysC can be used.

# Example workflow: aki_pt_data <- read.csv("aki.csv")
head(eGFR_pt_data)

eGFR(eGFR_pt_data,
  SCr = "SCr_", SCysC = "SCysC_",
  Age = "Age_", height = "height_", BUN = "BUN_",
  male = "male_", black = "black_", pediatric = "pediatric_"
)

eGFR_pt_data %>%
  dplyr::mutate(eGFR = eGFR(
    SCr = SCr_, SCysC = SCysC_,
    Age = Age_, height = height_, BUN = BUN_,
    male = male_, black = black_, pediatric = pediatric_
  )) %>%
  select(SCr_:pediatric_, eGFR)

eGFR_pt_data %>%
  dplyr::mutate(eGFR = eGFR_adult_SCr(
    SCr = SCr_, Age = Age_, male = male_, black = black_
  )) %>%
  select(SCr_:pediatric_, eGFR)

Reference

See https://alwinw.github.io/epocakir/reference/index.html for more usage details and package reference.

See https://kdigo.org/guidelines/ for full KDIGO guidelines.



Try the epocakir package in your browser

Any scripts or data that you put into this service are public.

epocakir documentation built on June 9, 2021, 9:07 a.m.