-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
183 lines (133 loc) · 6.29 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# epocakir
*/ˈiːpɒk ə keɪ aɪ ɑː/*
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/epocakir)](https://cran.r-project.org/package=epocakir)
[![R build status](https://github.com/alwinw/epocakir/workflows/R-CMD-check/badge.svg)](https://github.com/alwinw/epocakir/actions)
[![Codecov test coverage](https://codecov.io/gh/alwinw/epocakir/branch/master/graph/badge.svg)](https://codecov.io/gh/alwinw/epocakir?branch=master)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![Downloads](https://cranlogs.r-pkg.org/badges/epocakir)](https://cran.r-project.org/package=epocakir)
<!-- badges: end -->
## Clinical Coding of Patients with Kidney Disease
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](https://kdigo.org/guidelines/).
This package covers acute kidney injury (AKI), anemia, and chronic kidney disease (CKD):
- `aki_staging()`: Classification of AKI staging (`aki_stages`) with automatic selection of:
- `aki_bCr()`: AKI based on baseline creatinine
- `aki_SCr()`: AKI based on changes in serum creatinine
- `aki_UO()`: AKI based on urine output
- `anemia()`: Classification of anemia
- Classification of albuminuria (`Albuminuria_stages`)
- `Albuminuria_staging_ACR()`: Albuminuria based on Albumin excretion rate
- `Albuminuria_staging_AER()`: Albuminuria based on Albumin-to-creatinine ratio
- `eGFR()`: Estimation of glomerular filtration rate with automatic selection of:
- `eGFR_adult_SCr()`: eGFR based on the 2009 CKD-EPI creatinine equation
- `eGFR_adult_SCysC()`: eGFR based on the 2012 CKD-EPI cystatin C equation
- `eGFR_adult_SCr_SCysC()`: eGFR based on the 2012 CKD-EPI creatinine-cystatin C equation
- `eGFR_child_SCr()`: eGFR based on the pediatric creatinine-based equation
- `eGFR_child_SCr_BUN()`: eGFR based on the pediatric creatinine-BUN equation
- `eGFR_child_SCysC()`: eGFR based on the pediatric cystatin C-based equation
- `GFR_staging()`: Staging of GFR (`GFR_stages`)
- Multiple utility functions including:
- `conversion_factors`: Conversion factors used throughout the KDIGO guidelines
- `as_metric()`: Conversion of a measured value into metric units
- `dob2age()`: Calculation of age from a date of birth
- `binary2factor()`: Conversion of binary data into factors based on a column name
- `combine_date_time_cols()`: Combining separate date and time columns into a single date and time column
- `combn_changes`: Generating changes between measurements
## Installation
You can install the **released** version from [CRAN](https://cran.r-project.org/package=epocakir) with:
```{r cran, eval=FALSE}
install.packages("epocakir")
```
You can install the **development** version from [GitHub](https://github.com/alwinw/epocakir) with:
```{r dev, eval=FALSE}
# install.packages("remotes")
remotes::install_github("alwinw/epocakir")
```
## Getting Started
```{r pkgs, message = FALSE, warning=FALSE}
library(epocakir)
library(dplyr)
library(units)
```
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`:
```{r clinical_data}
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.
## Examples
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().`
```{r aki}
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)
```
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.
```{r eGFR}
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)
```
## References
KDIGO Guidelines - <https://kdigo.org/guidelines/>
## Activity
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/alwinw/epocakir)
![GitHub last commit](https://img.shields.io/github/last-commit/alwinw/epocakir)
![Visits](https://badges.pufler.dev/visits/alwinw/epocakir?&label=visits)
![GitHub repo size in bytes](https://img.shields.io/github/repo-size/alwinw/epocakir)
![Total Lines](https://img.shields.io/tokei/lines/github/alwinw/epocakir)
----
See <https://alwinw.github.io/epocakir/reference/index.html> for more usage details and package reference.