From 38f7f6380689ef7b33174751e691c2614ea347a7 Mon Sep 17 00:00:00 2001 From: alwinw <16846521+alwinw@users.noreply.github.com> Date: Sun, 6 Jun 2021 11:55:46 +1000 Subject: [PATCH 01/12] Added NEWS.md --- NEWS.md | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 NEWS.md diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..9890f0a --- /dev/null +++ b/NEWS.md @@ -0,0 +1,134 @@ +# epocakir 0.9.6 (development version) + +- Preparation for CRAN submission + +# epocakir 0.9.5 + +Added sample data and better examples + +## Improvements + +- Added sample data based on test data +- Cleaned up code comments +- Added examples to methods + +## Breaking Changes + +- Renamed `aki()` to `aki_staging()` for more consistent method names + +## Bug fixes + +- Fixed bug when n < m for combn() in combn_changes() +- Changed methods from `method.default()` to `method.data.frame()` to prevent infinite recursion on incorrectly specified function arguments + +# epocakir 0.9.0 + +Improved high level API functions + +## Improvements + +- Wrote new combined `eGFR()` function that automatically selects the appropriate `eGFR_method()` formula to use +- Wrote new combined `aki()` function that automatically calculates AKI based on all criteria and determines most severe stage +- Added additional tests including warnings + +## Breaking Changes + +- Added `No AKI` and `No Albuminuria` to stages ordered factors to prevent users have to handle `NAs` mixed with ordered factors + +## Bug fixes + +- Fixed bug in `eGFR_internal()` where it was looking for `!is.na(black)` to select `eGFR_adult_SCysC()`, when `black` was not required + +# epocakir 0.8.0 + +Initial full-featured release of epocakir methods + +## Improvements + +- Wrote `aki_SCr()` function +- Methods now include `aki_bCr`, `aki_SCr`, `aki_UO`, `anemia`, `eGFR_adult_SCr`, `eGFR_adult_SCysC`, `eGFR_adult_SCr_SCysC`, `eGFR_child_SCr`, `eGFR_child_SCr_BUN`, `eGFR_child_SCysC`, `GFR_staging`, `Albuminuria_staging_AER`, `Albuminuria_staging_ACR` and `combn_changes` + +## Bug fixes + +- Used `tibble::tibble()` instead of `data.frame()` to prevent issue with `stringsasfactors` difference between R 3.x and R 4.x +- FIxed sorting error in `aki_UO() + +# epocakir 0.7.0 + +Re-wrote methods for consistency + +## Improvements + +- Removed duplicate `GFR_staging()` code +- Stricter `expect_identical()` instead of `expect_equal()` assertions +- Rewrote `anemia()` to make method selection consistent with other functions + +## Bug fixes + +- Consistent parameter naming + +# epocakir 0.6.0 + +Re-wrote all eGFR functions as S3 methods + +## Improvements + +- Wrote `eGFR_adult_SCr`, `eGFR_adult_SCysC`, `eGFR_adult_SCr_SCysC`, `eGFR_child_SCr`, `eGFR_child_SCr_BUN`, `eGFR_child_SCysC` methods + +## Breaking changes + +- Instead of individual functions, use methods for all low-level functions +- Renamed functions to snake_case, e.g. `eGFR.adult.SCr_SCysC` to `eGFR_adult_SCr_SCysC` + +# epocakir 0.5.0 + +Improved handling of function arguments + +## Improvements + +- Changed from `forcats::fct_c` to `vctrs::vec_c` for improved `NA` handling () +- Wrote `aki_bCr()` method +- Allow symbols to be passed to methods + +## Breaking changes + +- Added version numbers to dependencies + +# epocakir 0.4.0 + +Added testing and additional utility functions to package + +## Improvements + +- Testing of edge-cases for `as_metric(NULL)`, `as_metric(1)` and unknown measurements +- Wrote `as_metric()` +- Additional KDIGO guidelines () added +- Added Albuminuria levels as an ordered factor + +## Bug fix + +- Correctly use `pmin` instead of `min` in eGFR calculation + +# epocakir 0.1.5 + +dplyr compatible functions + +## Improvements + +- Proper handling of column names using dplyr programming () +- Wrote `aki_bCr` calculation as part of `aki()` staging +- Wrote `.dob2age()` function to calculate a patient's age + +# epocakir 0.1.0 + +Initial release + +## Improvements + +- Wrote `combn_changes()` +- Wrote `conversion_factors()` +- Wrote initial functions based on KDIGO guidelines () + +# epocakir 0.0.0.9000 + +Initial development version From 03589e4e79b7a512e4eab52e7705721ac0566495 Mon Sep 17 00:00:00 2001 From: alwinw <16846521+alwinw@users.noreply.github.com> Date: Sun, 6 Jun 2021 12:10:03 +1000 Subject: [PATCH 02/12] Added cran-comments.md --- cran-comments.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 cran-comments.md diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..e345a5f --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,28 @@ +# Release Summary + +Initial release of `epocakir` v0.9.6 + +## R CMD check results + +0 errors v | 0 warnings v | 0 notes v + +R CMD check succeeded + +## Test Environments + +- Windows (Local) + - R version 4.0.3 (2020-10-10), Windows 10 x64, x86_64, mingw32 +- macOS-latest (on GitHub actions) + - R version 4.1.0 (2021-05-18), macOS Catalina 10.15.7, x86_64, darwin17.0 +- Windows-latest (on GitHub actions) + - R version 4.1.0 (2021-05-18), Windows Server x64, x86_64, mingw32 + - R version 3.6.3 (2020-02-29), Windows Server x64, x86_64, mingw32 +- Ubuntu-20.04 (on GitHub actions) + - R version 4.1.0 (2021-05-18), Ubuntu 20.04.2 LTS, x86_64, linux-gnu + - R Under development (unstable) (2021-06-03 r80452), Ubuntu 20.04.2 LTS, x86_64, linux-gnu +- Ubuntu-16.04 (on Github actions) + - R version 3.5.3 (2019-03-11), Ubuntu 16.04.7 LTS, x86_64, linux-gnu + +## Revdep checks + +No published downstream dependencies From 852456c25f6aac6e4397eddbcecda45a489e57c1 Mon Sep 17 00:00:00 2001 From: alwinw <16846521+alwinw@users.noreply.github.com> Date: Sun, 6 Jun 2021 12:33:13 +1000 Subject: [PATCH 03/12] Creation of vignette introduction --- DESCRIPTION | 2 +- vignettes/epocakir.Rmd | 70 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 vignettes/epocakir.Rmd diff --git a/DESCRIPTION b/DESCRIPTION index 18c3e78..75a1e6f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: epocakir Title: Clinical Coding of Patients with Kidney Disease using Clinical Practice Guidelines -Version: 0.9.5 +Version: 0.9.6 Authors@R: c(person(given = "Alwin", family = "Wang", diff --git a/vignettes/epocakir.Rmd b/vignettes/epocakir.Rmd new file mode 100644 index 0000000..acd7599 --- /dev/null +++ b/vignettes/epocakir.Rmd @@ -0,0 +1,70 @@ +--- +title: "Introduction to epocakir" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Vignette Title} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r opts, include = FALSE} +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](https://kdigo.org/guidelines/). This package covers acute kidney injury (AKI), anemia, and chronic liver disease(CKD). + +## Features + +- Classification of AKI staging: + + - AKI based on baseline creatinine + - AKI based on changes in serum creatinine + - AKI based on urine output + +- Classification of anemia + +- Classification of albuminuria + + - Albuminuria based on Albumin excretion rate + - Albuminuria based on Albumin-to-creatinine ratio + +- Estimation of glomerular filtration rate: + + - eGFR based on the 2009 CKD-EPI creatinine equation + - eGFR based on the 2012 CKD-EPI cystatin C equation + - eGFR based on the 2012 CKD-EPI creatinine-cystatin C equation + - eGFR based on the pediatric creatinine-based equation + - eGFR based on the pediatric creatinine-BUN equation + - eGFR based on the pediatric cystatin C-based equation + +- Multiple utility functions including: + + - Conversion factors used throughout the KDIGO guidelines + - Conversion of a measured value into metric units + - Calculation of age from a date of birth + - Conversion of binary data into factors based on a column name + - Combining seperate date and time columns into a single date and time column + - Generating changes between measurements + +- Automatic conversion of units class objects + +- Tidy output allowing seamless integratation with functions from the tidyverse + +- Tidyeval via programming with dplyr + +## Example + +```{r setup, 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. From 3d9dbec1cedb1ed2252eb8953d2aefee3632e29e Mon Sep 17 00:00:00 2001 From: alwinw <16846521+alwinw@users.noreply.github.com> Date: Sun, 6 Jun 2021 12:57:07 +1000 Subject: [PATCH 04/12] Added sample clinical data --- DESCRIPTION | 4 +++- R/data-clinical_obs.R | 7 +++++++ data-raw/clinical-data.R | 8 ++++++++ data/clinical_obvs.rda | Bin 0 -> 330 bytes man/clinical_obvs.Rd | 19 +++++++++++++++++++ vignettes/epocakir.Rmd | 2 +- 6 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 R/data-clinical_obs.R create mode 100644 data-raw/clinical-data.R create mode 100644 data/clinical_obvs.rda create mode 100644 man/clinical_obvs.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 75a1e6f..da68b7a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -36,8 +36,10 @@ Imports: Suggests: usethis, testthat, - covr + covr, + knitr Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) RoxygenNote: 7.1.1 +VignetteBuilder: knitr diff --git a/R/data-clinical_obs.R b/R/data-clinical_obs.R new file mode 100644 index 0000000..81359a8 --- /dev/null +++ b/R/data-clinical_obs.R @@ -0,0 +1,7 @@ +#' Clinical Patient Data +#' +#' A sample dataset to demonstrate ulitiy functions in `epocakir` +#' +#' @examples +#' clinical_obvs +"clinical_obvs" diff --git a/data-raw/clinical-data.R b/data-raw/clinical-data.R new file mode 100644 index 0000000..3ad0641 --- /dev/null +++ b/data-raw/clinical-data.R @@ -0,0 +1,8 @@ +clinical_obvs <- tibble::tribble( + ~`Patient Number`, ~`Admission Date`, ~`Admission Time`, ~`Discharge_date`, ~`Discharge_time`, ~`Date of Birth`, ~`Male`, + "p10001", "05/03/2020", "14:01:00", "10/03/2020", "16:34:00", "09/01/1956", TRUE, + "p10002", "06/03/2020", "09:10:00", "16/03/2020", "18:51:00", "04/12/1997", TRUE, + "p10003", "17/03/2020", "12:48:00", "18/03/2020", "09:12:00", "28/05/1973", TRUE, +) + +usethis::use_data(clinical_obvs, overwrite = TRUE) diff --git a/data/clinical_obvs.rda b/data/clinical_obvs.rda new file mode 100644 index 0000000000000000000000000000000000000000..c9aa628396d3ff3547b7fe98aed995bd84d039e7 GIT binary patch literal 330 zcmV-Q0k!@@T4*^jL0KkKS?WBMJ^%qD|G@wANB}?q|L`;eR6xJy-+({>00XcAI3Oid z{Dh6Fc^Mf^Fc29uFv?(UQz6U%000000001yO)2UI5g9ZM01rq8fDI8M0~R-0RZ*p6 zNi6I~yGqGsCdqef{j~u%vn3%UD%q8w%jK^5P7WDZnCHh3#<@Lfr_`2f5(_{EBn%i@ z(n%f+MQs6APmi~YUdyuGc5LKbqV`Q9W$`ecp)~=jB{4V`IN8=xWPU63bSBv0Uc&TX zkftg@WYWOiIl&g;iICf>wQ4m58+C&mIK32F&#Kc~49s0CKI~q?W#w1CgGq0kXq+s0 z2y82+ey1WiQRsvR!KLYXU@lTnq$IvsNg*k<=%33lgv7+&F2_zr6hhOg@H)iY3E6`O cDdfB(TTe+lQ9nNY1QYyS$rRy2L#Xmp_}&wWzW@LL literal 0 HcmV?d00001 diff --git a/man/clinical_obvs.Rd b/man/clinical_obvs.Rd new file mode 100644 index 0000000..58d71cb --- /dev/null +++ b/man/clinical_obvs.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data-clinical_obs.R +\docType{data} +\name{clinical_obvs} +\alias{clinical_obvs} +\title{Clinical Patient Data} +\format{ +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 3 rows and 7 columns. +} +\usage{ +clinical_obvs +} +\description{ +A sample dataset to demonstrate ulitiy functions in \code{epocakir} +} +\examples{ +clinical_obvs +} +\keyword{datasets} diff --git a/vignettes/epocakir.Rmd b/vignettes/epocakir.Rmd index acd7599..03f1a68 100644 --- a/vignettes/epocakir.Rmd +++ b/vignettes/epocakir.Rmd @@ -2,7 +2,7 @@ title: "Introduction to epocakir" output: rmarkdown::html_vignette vignette: > - %\VignetteIndexEntry{Vignette Title} + %\VignetteIndexEntry{Introduction to epocakir} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- From 9a8f14c32e809dbb683534743d49554549e54589 Mon Sep 17 00:00:00 2001 From: alwinw <16846521+alwinw@users.noreply.github.com> Date: Sun, 6 Jun 2021 14:23:05 +1000 Subject: [PATCH 05/12] Exploration of clinical_obvs --- _pkgdown.yml | 4 ++++ data-raw/clinical-data.R | 10 ++++++---- data/clinical_obvs.rda | Bin 330 -> 378 bytes man/clinical_obvs.Rd | 2 +- vignettes/epocakir.Rmd | 19 ++++++++++++++++++- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index 15f7cba..4f37e3c 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -2,3 +2,7 @@ url: https://alwinw.github.io/epocakir home: title: Clinical Coding of Patients with Kidney Disease + +authors: + Alwin Wang: + Lisa Toh: diff --git a/data-raw/clinical-data.R b/data-raw/clinical-data.R index 3ad0641..23ddbaa 100644 --- a/data-raw/clinical-data.R +++ b/data-raw/clinical-data.R @@ -1,8 +1,10 @@ clinical_obvs <- tibble::tribble( - ~`Patient Number`, ~`Admission Date`, ~`Admission Time`, ~`Discharge_date`, ~`Discharge_time`, ~`Date of Birth`, ~`Male`, - "p10001", "05/03/2020", "14:01:00", "10/03/2020", "16:34:00", "09/01/1956", TRUE, - "p10002", "06/03/2020", "09:10:00", "16/03/2020", "18:51:00", "04/12/1997", TRUE, - "p10003", "17/03/2020", "12:48:00", "18/03/2020", "09:12:00", "28/05/1973", TRUE, + ~`Patient Number`, ~`Admission Date`, ~`Admission Time`, ~`Discharge_date`, ~`Discharge_time`, + ~`Date of Birth`, ~`Male`, ~`Height`, ~`Surgery`, + "p10001", "2020-03-05", "14:01:00", "2020-03-10", "16:34:00", "1956-01-09", TRUE, 182, FALSE, + "p10002", "2020-03-06", "09:10:00", "2020-03-16", "18:51:00", "1997-12-04", FALSE, 161, FALSE, + "p10003", "2020-03-17", "12:48:00", "2020-03-18", "09:12:00", "1973-05-28", TRUE, 168, TRUE, ) +# Consider finding an alternative with real, open access data instead usethis::use_data(clinical_obvs, overwrite = TRUE) diff --git a/data/clinical_obvs.rda b/data/clinical_obvs.rda index c9aa628396d3ff3547b7fe98aed995bd84d039e7..977fecee85be3f5ca42079b8765c0cd9cc77f02d 100644 GIT binary patch literal 378 zcmV-=0fqiTT4*^jL0KkKS@S)ikGgAaK4FCWdG-!H2YMz=B4GjQj9+OOiKpFtZXbBQQ6BB5Mq-fJYkQx96 zgD0rhRJ*7s3JcpTsVP-eE=?xV!8~v=8d-IUGEIvcn*E=*QVE%5%OnXa?N-t@{XMBJ z)0c`hRG@T6CV0%}&S|-8R4jN9j3NP~1-#HH14h$8h3A?CVPXn?EBoAcuwfOvixbM# ze)du-DHmX&NHj_&6Ou-Pc@oyBhdB+8rBATywE~z_NRfG>ffYoUJZL&33^;}oi6jsc zn8BzhS6bLFX&Sngvm3EgJ#w5JHq)$ literal 330 zcmV-Q0k!@@T4*^jL0KkKS?WBMJ^%qD|G@wANB}?q|L`;eR6xJy-+({>00XcAI3Oid z{Dh6Fc^Mf^Fc29uFv?(UQz6U%000000001yO)2UI5g9ZM01rq8fDI8M0~R-0RZ*p6 zNi6I~yGqGsCdqef{j~u%vn3%UD%q8w%jK^5P7WDZnCHh3#<@Lfr_`2f5(_{EBn%i@ z(n%f+MQs6APmi~YUdyuGc5LKbqV`Q9W$`ecp)~=jB{4V`IN8=xWPU63bSBv0Uc&TX zkftg@WYWOiIl&g;iICf>wQ4m58+C&mIK32F&#Kc~49s0CKI~q?W#w1CgGq0kXq+s0 z2y82+ey1WiQRsvR!KLYXU@lTnq$IvsNg*k<=%33lgv7+&F2_zr6hhOg@H)iY3E6`O cDdfB(TTe+lQ9nNY1QYyS$rRy2L#Xmp_}&wWzW@LL diff --git a/man/clinical_obvs.Rd b/man/clinical_obvs.Rd index 58d71cb..19d4482 100644 --- a/man/clinical_obvs.Rd +++ b/man/clinical_obvs.Rd @@ -5,7 +5,7 @@ \alias{clinical_obvs} \title{Clinical Patient Data} \format{ -An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 3 rows and 7 columns. +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 3 rows and 9 columns. } \usage{ clinical_obvs diff --git a/vignettes/epocakir.Rmd b/vignettes/epocakir.Rmd index 03f1a68..12f3c99 100644 --- a/vignettes/epocakir.Rmd +++ b/vignettes/epocakir.Rmd @@ -59,6 +59,8 @@ The epocakir package makes clinical coding of patients with kidney disease using - Tidyeval via programming with dplyr +- Comprehensive tests and coverage + ## Example ```{r setup, message = FALSE, warning=FALSE} @@ -67,4 +69,19 @@ 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. +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} +# 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) +``` From 2a95cb7d530c1f3eeb9da865c9ea0c3bc24afa15 Mon Sep 17 00:00:00 2001 From: alwinw <16846521+alwinw@users.noreply.github.com> Date: Sun, 6 Jun 2021 14:49:00 +1000 Subject: [PATCH 06/12] Exported conversion factors --- NAMESPACE | 1 + NEWS.md | 4 ---- R/utils.R | 5 ++++- man/as_metric.Rd | 2 +- man/conversion_factors.Rd | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 43b3405..05b445e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -63,6 +63,7 @@ export(as_metric) export(binary2factor) export(combine_date_time_cols) export(combn_changes) +export(conversion_factors) export(dob2age) export(eGFR) export(eGFR_adult_SCr) diff --git a/NEWS.md b/NEWS.md index 9890f0a..ed965f0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -128,7 +128,3 @@ Initial release - Wrote `combn_changes()` - Wrote `conversion_factors()` - Wrote initial functions based on KDIGO guidelines () - -# epocakir 0.0.0.9000 - -Initial development version diff --git a/R/utils.R b/R/utils.R index cbf5a20..c3ed8f0 100644 --- a/R/utils.R +++ b/R/utils.R @@ -22,8 +22,9 @@ NULL #' \item{mol_weight}{Molecular weight (where required)} #' \item{description}{Full name} #' } +#' @export #' @examples -#' epocakir:::conversion_factors +#' conversion_factors conversion_factors <- tibble::tribble( ~parameter, ~metric_units, ~mol_weight, ~description, # General @@ -60,6 +61,8 @@ conversion_factors <- tibble::tribble( #' Convert a measured value to metric units #' +#' Refer to [`conversion_factors`] for a full list of available conversions +#' #' @param param (character) Name of measurement, e.g. param = "SCr" #' @param meas (units) Measurement or vector of measurements #' @param ... (units) One of conversion_factors$parameter, diff --git a/man/as_metric.Rd b/man/as_metric.Rd index ff3ee24..9b801e5 100644 --- a/man/as_metric.Rd +++ b/man/as_metric.Rd @@ -22,7 +22,7 @@ Case insensitive.} unless \code{value_only = T} } \description{ -Convert a measured value to metric units +Refer to \code{\link{conversion_factors}} for a full list of available conversions } \examples{ as_metric(param = "scr", meas = units::set_units(88.4, "umol/l")) diff --git a/man/conversion_factors.Rd b/man/conversion_factors.Rd index eb0d5de..a87ae1d 100644 --- a/man/conversion_factors.Rd +++ b/man/conversion_factors.Rd @@ -23,6 +23,6 @@ Guidelines. } } \examples{ -epocakir:::conversion_factors +conversion_factors } \keyword{datasets} From 2cdad6beaafb41b7bebabe2b02c58a258207250a Mon Sep 17 00:00:00 2001 From: alwinw <16846521+alwinw@users.noreply.github.com> Date: Sun, 6 Jun 2021 14:49:12 +1000 Subject: [PATCH 07/12] Added more examples to vignette --- vignettes/epocakir.Rmd | 68 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/vignettes/epocakir.Rmd b/vignettes/epocakir.Rmd index 12f3c99..376df0b 100644 --- a/vignettes/epocakir.Rmd +++ b/vignettes/epocakir.Rmd @@ -61,7 +61,7 @@ The epocakir package makes clinical coding of patients with kidney disease using - Comprehensive tests and coverage -## Example +## Examples ```{r setup, message = FALSE, warning=FALSE} library(epocakir) @@ -69,7 +69,9 @@ 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` +### 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`: ```{r clinical_data} # Example workflow: clinical_obvs <- read.csv("cohort.csv") @@ -85,3 +87,65 @@ tidy_obvs <- clinical_obvs %>% glimpse(tidy_obvs) ``` + +### 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().` + +```{r aki} +# 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. + +```{r eGFR} +# 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 for more usage details and package reference. + +See for full KDIGO guidelines. From 6a0176f0d80cd6dc5f7d6f9f187a4e1692a3c28e Mon Sep 17 00:00:00 2001 From: alwinw <16846521+alwinw@users.noreply.github.com> Date: Sun, 6 Jun 2021 15:30:34 +1000 Subject: [PATCH 08/12] Updated README --- .gitignore | 1 + DESCRIPTION | 3 +- README.Rmd | 128 +++++++++++++++++++-- README.md | 254 ++++++++++++++++++++++++++++++++++++++++- vignettes/.gitignore | 2 + vignettes/epocakir.Rmd | 75 ++++++------ 6 files changed, 418 insertions(+), 45 deletions(-) create mode 100644 vignettes/.gitignore diff --git a/.gitignore b/.gitignore index a50f6ff..50da77c 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ vignettes/*.pdf # R Environment Variables .Renviron .Rproj.user +inst/doc diff --git a/DESCRIPTION b/DESCRIPTION index da68b7a..44bf00e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -37,7 +37,8 @@ Suggests: usethis, testthat, covr, - knitr + knitr, + rmarkdown Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) diff --git a/README.Rmd b/README.Rmd index 8703dc4..c4b9a0f 100644 --- a/README.Rmd +++ b/README.Rmd @@ -21,16 +21,49 @@ knitr::opts_chunk$set( [![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) +[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) ## 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 liver disease(CKD). +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 liver 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 @@ -42,7 +75,7 @@ install.packages("epocakir") ``` --> -You can install the **development** version from [GitHub](https://github.com/) with: +You can install the **development** version from [GitHub](https://github.com/alwinw/epocakir) with: ``` r # install.packages("devtools") @@ -51,11 +84,86 @@ devtools::install_github("alwinw/epocakir") ## Getting Started -Instructions to come +```{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 -Examples to come +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 @@ -68,3 +176,7 @@ KDIGO Guidelines - ![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 for more usage details and package reference. diff --git a/README.md b/README.md index 25b651f..8ec8c26 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ 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) +[![Lifecycle: +stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) @@ -20,7 +22,53 @@ 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 liver -disease(CKD). +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 @@ -33,7 +81,7 @@ install.packages("epocakir") --> You can install the **development** version from -[GitHub](https://github.com/) with: +[GitHub](https://github.com/alwinw/epocakir) with: ``` r # install.packages("devtools") @@ -42,11 +90,204 @@ devtools::install_github("alwinw/epocakir") ## Getting Started -Instructions to come +``` r +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 +glimpse(clinical_obvs) +#> Rows: 3 +#> Columns: 9 +#> $ `Patient Number` "p10001", "p10002", "p10003" +#> $ `Admission Date` "2020-03-05", "2020-03-06", "2020-03-17" +#> $ `Admission Time` "14:01:00", "09:10:00", "12:48:00" +#> $ Discharge_date "2020-03-10", "2020-03-16", "2020-03-18" +#> $ Discharge_time "16:34:00", "18:51:00", "09:12:00" +#> $ `Date of Birth` "1956-01-09", "1997-12-04", "1973-05-28" +#> $ Male TRUE, FALSE, TRUE +#> $ Height 182, 161, 168 +#> $ Surgery FALSE, FALSE, TRUE + +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) +#> Rows: 3 +#> Columns: 8 +#> $ `Patient Number` "p10001", "p10002", "p10003" +#> $ `Admission DateTime` 2020-03-05 14:01:00, 2020-03-06 09:10:00, 202... +#> $ Discharge_DateTime 2020-03-10 16:34:00, 2020-03-16 18:51:00, 202... +#> $ `Date of Birth` "1956-01-09", "1997-12-04", "1973-05-28" +#> $ Male Male, Not_Male, Male +#> $ Height [m] 1.82 [m], 1.61 [m], 1.68 [m] +#> $ Surgery Not_Surgery, Not_Surgery, Surgery +#> $ Age 2064096000s (~65.41 years), 741744000s (~... +``` + +Make sure to use `set_units()` from the `units` package to convert all +measurements into unit objects for automatic unit conversion in +epocakir. ## Examples -Examples to come +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 +head(aki_pt_data) +#> # A tibble: 6 x 7 +#> SCr_ bCr_ pt_id_ dttm_ UO_ aki_staging_type aki_ +#> [mg/dl] [mg/dl] [ml/kg] +#> 1 2.0 1.5 NA NA aki_bCr No AKI +#> 2 2.5 1.5 NA NA aki_bCr AKI Stag~ +#> 3 3.0 1.5 NA NA aki_bCr AKI Stag~ +#> 4 3.5 1.5 NA NA aki_bCr AKI Stag~ +#> 5 4.0 1.5 NA NA aki_bCr AKI Stag~ +#> 6 4.5 1.5 NA NA aki_bCr AKI Stag~ + +aki_staging(aki_pt_data, + SCr = "SCr_", bCr = "bCr_", UO = "UO_", + dttm = "dttm_", pt_id = "pt_id_" +) +#> [1] No AKI AKI Stage 1 AKI Stage 2 AKI Stage 2 AKI Stage 3 AKI Stage 3 +#> [7] No AKI No AKI AKI Stage 1 No AKI No AKI AKI Stage 1 +#> [13] No AKI No AKI No AKI AKI Stage 1 No AKI AKI Stage 2 +#> [19] AKI Stage 3 AKI Stage 1 AKI Stage 3 AKI Stage 2 No AKI AKI Stage 1 +#> [25] AKI Stage 3 AKI Stage 3 No AKI +#> Levels: No AKI < AKI Stage 1 < AKI Stage 2 < AKI Stage 3 + +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) +#> # A tibble: 27 x 5 +#> pt_id_ SCr_ bCr_ dttm_ aki +#> [mg/dl] [mg/dl] +#> 1 2.0 1.5 NA No AKI +#> 2 2.5 1.5 NA AKI Stage 1 +#> 3 3.0 1.5 NA AKI Stage 2 +#> 4 3.5 1.5 NA AKI Stage 2 +#> 5 4.0 1.5 NA AKI Stage 3 +#> 6 4.5 1.5 NA AKI Stage 3 +#> 7 pt1 3.4 NA 2020-10-23 09:00:00 No AKI +#> 8 pt1 3.9 NA 2020-10-25 21:00:00 No AKI +#> 9 pt1 3.0 NA 2020-10-20 09:00:00 AKI Stage 1 +#> 10 pt2 3.4 NA 2020-10-18 22:00:00 No AKI +#> # ... with 17 more rows + +aki_pt_data %>% + mutate(aki = aki_SCr( + SCr = SCr_, dttm = dttm_, pt_id = pt_id_ + )) %>% + select(pt_id_, SCr_:dttm_, aki) +#> # A tibble: 27 x 5 +#> pt_id_ SCr_ bCr_ dttm_ aki +#> [mg/dl] [mg/dl] +#> 1 2.0 1.5 NA No AKI +#> 2 2.5 1.5 NA No AKI +#> 3 3.0 1.5 NA No AKI +#> 4 3.5 1.5 NA No AKI +#> 5 4.0 1.5 NA No AKI +#> 6 4.5 1.5 NA No AKI +#> 7 pt1 3.4 NA 2020-10-23 09:00:00 No AKI +#> 8 pt1 3.9 NA 2020-10-25 21:00:00 No AKI +#> 9 pt1 3.0 NA 2020-10-20 09:00:00 AKI Stage 1 +#> 10 pt2 3.4 NA 2020-10-18 22:00:00 No AKI +#> # ... with 17 more rows +``` + +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 +head(eGFR_pt_data) +#> # A tibble: 6 x 10 +#> SCr_ SCysC_ Age_ male_ black_ height_ BUN_ eGFR_calc_type_ +#> [mg/dl] [mg/L] [years] [m] [mg/dl] +#> 1 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr +#> 2 NA 0.4 20 FALSE FALSE NA NA eGFR_adult_SCy~ +#> 3 0.5 0.4 20 FALSE FALSE NA NA eGFR_adult_SCr~ +#> 4 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr +#> 5 NA 0.4 30 FALSE TRUE NA NA eGFR_adult_SCy~ +#> 6 0.5 0.4 30 FALSE TRUE NA NA eGFR_adult_SCr~ +#> # ... with 2 more variables: eGFR_ [mL/1.73m2/min], pediatric_ + +eGFR(eGFR_pt_data, + SCr = "SCr_", SCysC = "SCysC_", + Age = "Age_", height = "height_", BUN = "BUN_", + male = "male_", black = "black_", pediatric = "pediatric_" +) +#> Units: [mL/1.73m2/min] +#> [1] 139.32466 161.68446 166.81886 150.52336 155.33226 171.35616 139.32466 +#> [8] 66.77365 96.41798 150.52336 64.15027 99.04045 49.63420 161.68446 +#> [15] 97.06854 53.62373 155.33226 99.70870 49.63420 66.77365 56.10368 +#> [22] 53.62373 64.15027 57.62964 155.99874 173.48118 178.86404 168.53768 +#> [29] 166.66552 183.72895 155.99874 71.64555 103.37985 168.53768 68.83077 +#> [36] 106.19167 66.06766 173.48118 116.50660 71.37808 166.66552 119.67546 +#> [43] 66.06766 71.64555 67.33849 71.37808 68.83077 69.17003 99.12000 +#> [50] 148.21219 165.89761 + +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) +#> # A tibble: 51 x 11 +#> SCr_ SCysC_ Age_ male_ black_ height_ BUN_ eGFR_calc_type_ +#> [mg/dl] [mg/L] [years] [m] [mg/dl] +#> 1 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr +#> 2 NA 0.4 20 FALSE FALSE NA NA eGFR_adult_SCy~ +#> 3 0.5 0.4 20 FALSE FALSE NA NA eGFR_adult_SCr~ +#> 4 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr +#> 5 NA 0.4 30 FALSE TRUE NA NA eGFR_adult_SCy~ +#> 6 0.5 0.4 30 FALSE TRUE NA NA eGFR_adult_SCr~ +#> 7 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr +#> 8 NA 1.2 20 FALSE FALSE NA NA eGFR_adult_SCy~ +#> 9 0.5 1.2 20 FALSE FALSE NA NA eGFR_adult_SCr~ +#> 10 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr +#> # ... with 41 more rows, and 3 more variables: eGFR_ [mL/1.73m2/min], +#> # pediatric_ , eGFR [mL/1.73m2/min] + +eGFR_pt_data %>% + dplyr::mutate(eGFR = eGFR_adult_SCr( + SCr = SCr_, Age = Age_, male = male_, black = black_ + )) %>% + select(SCr_:pediatric_, eGFR) +#> # A tibble: 51 x 11 +#> SCr_ SCysC_ Age_ male_ black_ height_ BUN_ eGFR_calc_type_ +#> [mg/dl] [mg/L] [years] [m] [mg/dl] +#> 1 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr +#> 2 NA 0.4 20 FALSE FALSE NA NA eGFR_adult_SCy~ +#> 3 0.5 0.4 20 FALSE FALSE NA NA eGFR_adult_SCr~ +#> 4 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr +#> 5 NA 0.4 30 FALSE TRUE NA NA eGFR_adult_SCy~ +#> 6 0.5 0.4 30 FALSE TRUE NA NA eGFR_adult_SCr~ +#> 7 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr +#> 8 NA 1.2 20 FALSE FALSE NA NA eGFR_adult_SCy~ +#> 9 0.5 1.2 20 FALSE FALSE NA NA eGFR_adult_SCr~ +#> 10 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr +#> # ... with 41 more rows, and 3 more variables: eGFR_ [mL/1.73m2/min], +#> # pediatric_ , eGFR [mL/1.73m2/min] +``` ## References @@ -62,3 +303,8 @@ commit](https://img.shields.io/github/last-commit/alwinw/epocakir) ![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 for more +usage details and package reference. diff --git a/vignettes/.gitignore b/vignettes/.gitignore new file mode 100644 index 0000000..097b241 --- /dev/null +++ b/vignettes/.gitignore @@ -0,0 +1,2 @@ +*.html +*.R diff --git a/vignettes/epocakir.Rmd b/vignettes/epocakir.Rmd index 376df0b..850fc4f 100644 --- a/vignettes/epocakir.Rmd +++ b/vignettes/epocakir.Rmd @@ -7,7 +7,7 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r opts, include = FALSE} +```{r setup, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>", @@ -18,52 +18,56 @@ knitr::opts_chunk$set( ## 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](https://kdigo.org/guidelines/). This package covers acute kidney injury (AKI), anemia, and chronic liver disease(CKD). +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 liver disease(CKD). ## Features -- Classification of AKI staging: +- `aki_staging()`: Classification of AKI staging (`aki_stages`) with automatic selection of: - - AKI based on baseline creatinine - - AKI based on changes in serum creatinine - - AKI based on urine output + - `aki_bCr()`: AKI based on baseline creatinine + - `aki_SCr()`: AKI based on changes in serum creatinine + - `aki_UO()`: AKI based on urine output -- Classification of anemia +- `anemia()`: Classification of anemia -- Classification of albuminuria +- Classification of albuminuria (`Albuminuria_stages`) - - Albuminuria based on Albumin excretion rate - - Albuminuria based on Albumin-to-creatinine ratio + - `Albuminuria_staging_ACR()`: Albuminuria based on Albumin excretion rate + - `Albuminuria_staging_AER()`: Albuminuria based on Albumin-to-creatinine ratio -- Estimation of glomerular filtration rate: +- `eGFR()`: Estimation of glomerular filtration rate with automatic selection of: - - eGFR based on the 2009 CKD-EPI creatinine equation - - eGFR based on the 2012 CKD-EPI cystatin C equation - - eGFR based on the 2012 CKD-EPI creatinine-cystatin C equation - - eGFR based on the pediatric creatinine-based equation - - eGFR based on the pediatric creatinine-BUN equation - - eGFR based on the pediatric cystatin C-based equation + - `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 -- Multiple utility functions including: +- `GFR_staging()`: Staging of GFR (`GFR_stages`) + +- Multiple utility functions including: - - Conversion factors used throughout the KDIGO guidelines - - Conversion of a measured value into metric units - - Calculation of age from a date of birth - - Conversion of binary data into factors based on a column name - - Combining seperate date and time columns into a single date and time column - - Generating changes between measurements + - `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 -- Automatic conversion of units class objects +- Automatic conversion of units class objects -- Tidy output allowing seamless integratation with functions from the tidyverse +- Tidy output allowing seamless integration with functions from the tidyverse -- Tidyeval via programming with dplyr +- Tidyeval via programming with dplyr -- Comprehensive tests and coverage +- Comprehensive tests and coverage ## Examples -```{r setup, message = FALSE, warning=FALSE} +```{r pkgs, message = FALSE, warning=FALSE} library(epocakir) library(dplyr) library(units) @@ -71,7 +75,9 @@ 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`: +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} # Example workflow: clinical_obvs <- read.csv("cohort.csv") @@ -88,9 +94,13 @@ tidy_obvs <- clinical_obvs %>% 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().` +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().` ```{r aki} # Example workflow: aki_pt_data <- read.csv("aki.csv") @@ -117,7 +127,8 @@ aki_pt_data %>% ### 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. +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} # Example workflow: aki_pt_data <- read.csv("aki.csv") From 0308ed8986120421db1765184e90001f693df581 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sun, 6 Jun 2021 05:31:59 +0000 Subject: [PATCH 09/12] Re-build README.Rmd --- README.md | 146 +++++++++++++++++++++++++++--------------------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index 8ec8c26..83fd47a 100644 --- a/README.md +++ b/README.md @@ -24,51 +24,51 @@ the evidence-based [KDIGO guidelines](https://kdigo.org/guidelines/). This package covers acute kidney injury (AKI), anemia, and chronic liver disease(CKD): -- `aki_staging()`: Classification of AKI staging (`aki_stages`) with + - `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 - - `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 -- `anemia()`: Classification of anemia - -- Classification of albuminuria (`Albuminuria_stages`) - - - `Albuminuria_staging_ACR()`: Albuminuria based on Albumin + - Classification of albuminuria (`Albuminuria_stages`) + + - `Albuminuria_staging_ACR()`: Albuminuria based on Albumin excretion rate - - `Albuminuria_staging_AER()`: Albuminuria based on + - `Albuminuria_staging_AER()`: Albuminuria based on Albumin-to-creatinine ratio -- `eGFR()`: Estimation of glomerular filtration rate with automatic + - `eGFR()`: Estimation of glomerular filtration rate with automatic selection of: - - - `eGFR_adult_SCr()`: eGFR based on the 2009 CKD-EPI creatinine + + - `eGFR_adult_SCr()`: eGFR based on the 2009 CKD-EPI creatinine equation - - `eGFR_adult_SCysC()`: eGFR based on the 2012 CKD-EPI cystatin C + - `eGFR_adult_SCysC()`: eGFR based on the 2012 CKD-EPI cystatin C equation - - `eGFR_adult_SCr_SCysC()`: eGFR based on the 2012 CKD-EPI + - `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 + - `eGFR_child_SCr()`: eGFR based on the pediatric creatinine-based equation - - `eGFR_child_SCr_BUN()`: eGFR based on the pediatric + - `eGFR_child_SCr_BUN()`: eGFR based on the pediatric creatinine-BUN equation - - `eGFR_child_SCysC()`: eGFR based on the pediatric cystatin + - `eGFR_child_SCysC()`: eGFR based on the pediatric cystatin C-based equation -- `GFR_staging()`: Staging of GFR (`GFR_stages`) - -- Multiple utility functions including: + - `GFR_staging()`: Staging of GFR (`GFR_stages`) - - `conversion_factors`: Conversion factors used throughout the + - 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 + - `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 + - `combine_date_time_cols()`: Combining separate date and time columns into a single date and time column - - `combn_changes`: Generating changes between measurements + - `combn_changes`: Generating changes between measurements ## Installation @@ -126,13 +126,13 @@ glimpse(tidy_obvs) #> Rows: 3 #> Columns: 8 #> $ `Patient Number` "p10001", "p10002", "p10003" -#> $ `Admission DateTime` 2020-03-05 14:01:00, 2020-03-06 09:10:00, 202... -#> $ Discharge_DateTime 2020-03-10 16:34:00, 2020-03-16 18:51:00, 202... +#> $ `Admission DateTime` 2020-03-05 14:01:00, 2020-03-06 09:10:00, 2020-03… +#> $ Discharge_DateTime 2020-03-10 16:34:00, 2020-03-16 18:51:00, 2020-0… #> $ `Date of Birth` "1956-01-09", "1997-12-04", "1973-05-28" #> $ Male Male, Not_Male, Male #> $ Height [m] 1.82 [m], 1.61 [m], 1.68 [m] #> $ Surgery Not_Surgery, Not_Surgery, Surgery -#> $ Age 2064096000s (~65.41 years), 741744000s (~... +#> $ Age 2064096000s (~65.41 years), 741744000s (~23.5 ye… ``` Make sure to use `set_units()` from the `units` package to convert all @@ -151,11 +151,11 @@ head(aki_pt_data) #> SCr_ bCr_ pt_id_ dttm_ UO_ aki_staging_type aki_ #> [mg/dl] [mg/dl] [ml/kg] #> 1 2.0 1.5 NA NA aki_bCr No AKI -#> 2 2.5 1.5 NA NA aki_bCr AKI Stag~ -#> 3 3.0 1.5 NA NA aki_bCr AKI Stag~ -#> 4 3.5 1.5 NA NA aki_bCr AKI Stag~ -#> 5 4.0 1.5 NA NA aki_bCr AKI Stag~ -#> 6 4.5 1.5 NA NA aki_bCr AKI Stag~ +#> 2 2.5 1.5 NA NA aki_bCr AKI Stag… +#> 3 3.0 1.5 NA NA aki_bCr AKI Stag… +#> 4 3.5 1.5 NA NA aki_bCr AKI Stag… +#> 5 4.0 1.5 NA NA aki_bCr AKI Stag… +#> 6 4.5 1.5 NA NA aki_bCr AKI Stag… aki_staging(aki_pt_data, SCr = "SCr_", bCr = "bCr_", UO = "UO_", @@ -187,7 +187,7 @@ aki_pt_data %>% #> 8 pt1 3.9 NA 2020-10-25 21:00:00 No AKI #> 9 pt1 3.0 NA 2020-10-20 09:00:00 AKI Stage 1 #> 10 pt2 3.4 NA 2020-10-18 22:00:00 No AKI -#> # ... with 17 more rows +#> # … with 17 more rows aki_pt_data %>% mutate(aki = aki_SCr( @@ -207,7 +207,7 @@ aki_pt_data %>% #> 8 pt1 3.9 NA 2020-10-25 21:00:00 No AKI #> 9 pt1 3.0 NA 2020-10-20 09:00:00 AKI Stage 1 #> 10 pt2 3.4 NA 2020-10-18 22:00:00 No AKI -#> # ... with 17 more rows +#> # … with 17 more rows ``` Similarly, `eGFR()` offers the ability to automatically select the @@ -219,15 +219,15 @@ particular formula is required, then `eGFR_adult_SCr`, ``` r head(eGFR_pt_data) #> # A tibble: 6 x 10 -#> SCr_ SCysC_ Age_ male_ black_ height_ BUN_ eGFR_calc_type_ -#> [mg/dl] [mg/L] [years] [m] [mg/dl] -#> 1 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr -#> 2 NA 0.4 20 FALSE FALSE NA NA eGFR_adult_SCy~ -#> 3 0.5 0.4 20 FALSE FALSE NA NA eGFR_adult_SCr~ -#> 4 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr -#> 5 NA 0.4 30 FALSE TRUE NA NA eGFR_adult_SCy~ -#> 6 0.5 0.4 30 FALSE TRUE NA NA eGFR_adult_SCr~ -#> # ... with 2 more variables: eGFR_ [mL/1.73m2/min], pediatric_ +#> SCr_ SCysC_ Age_ male_ black_ height_ BUN_ eGFR_calc_type_ +#> [mg/dl] [mg/L] [years] [m] [mg/dl] +#> 1 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr +#> 2 NA 0.4 20 FALSE FALSE NA NA eGFR_adult_SCysC +#> 3 0.5 0.4 20 FALSE FALSE NA NA eGFR_adult_SCr_SCysC +#> 4 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr +#> 5 NA 0.4 30 FALSE TRUE NA NA eGFR_adult_SCysC +#> 6 0.5 0.4 30 FALSE TRUE NA NA eGFR_adult_SCr_SCysC +#> # … with 2 more variables: eGFR_ [mL/1.73m2/min], pediatric_ eGFR(eGFR_pt_data, SCr = "SCr_", SCysC = "SCysC_", @@ -252,19 +252,19 @@ eGFR_pt_data %>% )) %>% select(SCr_:pediatric_, eGFR) #> # A tibble: 51 x 11 -#> SCr_ SCysC_ Age_ male_ black_ height_ BUN_ eGFR_calc_type_ -#> [mg/dl] [mg/L] [years] [m] [mg/dl] -#> 1 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr -#> 2 NA 0.4 20 FALSE FALSE NA NA eGFR_adult_SCy~ -#> 3 0.5 0.4 20 FALSE FALSE NA NA eGFR_adult_SCr~ -#> 4 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr -#> 5 NA 0.4 30 FALSE TRUE NA NA eGFR_adult_SCy~ -#> 6 0.5 0.4 30 FALSE TRUE NA NA eGFR_adult_SCr~ -#> 7 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr -#> 8 NA 1.2 20 FALSE FALSE NA NA eGFR_adult_SCy~ -#> 9 0.5 1.2 20 FALSE FALSE NA NA eGFR_adult_SCr~ -#> 10 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr -#> # ... with 41 more rows, and 3 more variables: eGFR_ [mL/1.73m2/min], +#> SCr_ SCysC_ Age_ male_ black_ height_ BUN_ eGFR_calc_type_ +#> [mg/dl] [mg/L] [years] [m] [mg/dl] +#> 1 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr +#> 2 NA 0.4 20 FALSE FALSE NA NA eGFR_adult_SCysC +#> 3 0.5 0.4 20 FALSE FALSE NA NA eGFR_adult_SCr_SCysC +#> 4 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr +#> 5 NA 0.4 30 FALSE TRUE NA NA eGFR_adult_SCysC +#> 6 0.5 0.4 30 FALSE TRUE NA NA eGFR_adult_SCr_SCysC +#> 7 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr +#> 8 NA 1.2 20 FALSE FALSE NA NA eGFR_adult_SCysC +#> 9 0.5 1.2 20 FALSE FALSE NA NA eGFR_adult_SCr_SCysC +#> 10 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr +#> # … with 41 more rows, and 3 more variables: eGFR_ [mL/1.73m2/min], #> # pediatric_ , eGFR [mL/1.73m2/min] eGFR_pt_data %>% @@ -273,19 +273,19 @@ eGFR_pt_data %>% )) %>% select(SCr_:pediatric_, eGFR) #> # A tibble: 51 x 11 -#> SCr_ SCysC_ Age_ male_ black_ height_ BUN_ eGFR_calc_type_ -#> [mg/dl] [mg/L] [years] [m] [mg/dl] -#> 1 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr -#> 2 NA 0.4 20 FALSE FALSE NA NA eGFR_adult_SCy~ -#> 3 0.5 0.4 20 FALSE FALSE NA NA eGFR_adult_SCr~ -#> 4 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr -#> 5 NA 0.4 30 FALSE TRUE NA NA eGFR_adult_SCy~ -#> 6 0.5 0.4 30 FALSE TRUE NA NA eGFR_adult_SCr~ -#> 7 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr -#> 8 NA 1.2 20 FALSE FALSE NA NA eGFR_adult_SCy~ -#> 9 0.5 1.2 20 FALSE FALSE NA NA eGFR_adult_SCr~ -#> 10 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr -#> # ... with 41 more rows, and 3 more variables: eGFR_ [mL/1.73m2/min], +#> SCr_ SCysC_ Age_ male_ black_ height_ BUN_ eGFR_calc_type_ +#> [mg/dl] [mg/L] [years] [m] [mg/dl] +#> 1 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr +#> 2 NA 0.4 20 FALSE FALSE NA NA eGFR_adult_SCysC +#> 3 0.5 0.4 20 FALSE FALSE NA NA eGFR_adult_SCr_SCysC +#> 4 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr +#> 5 NA 0.4 30 FALSE TRUE NA NA eGFR_adult_SCysC +#> 6 0.5 0.4 30 FALSE TRUE NA NA eGFR_adult_SCr_SCysC +#> 7 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr +#> 8 NA 1.2 20 FALSE FALSE NA NA eGFR_adult_SCysC +#> 9 0.5 1.2 20 FALSE FALSE NA NA eGFR_adult_SCr_SCysC +#> 10 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr +#> # … with 41 more rows, and 3 more variables: eGFR_ [mL/1.73m2/min], #> # pediatric_ , eGFR [mL/1.73m2/min] ``` @@ -304,7 +304,7 @@ commit](https://img.shields.io/github/last-commit/alwinw/epocakir) bytes](https://img.shields.io/github/repo-size/alwinw/epocakir) ![Total Lines](https://img.shields.io/tokei/lines/github/alwinw/epocakir) ------------------------------------------------------------------------- +----- See for more usage details and package reference. From 90ee47865a4bc28874a229a73974a2ecae8b8f73 Mon Sep 17 00:00:00 2001 From: alwinw <16846521+alwinw@users.noreply.github.com> Date: Sun, 6 Jun 2021 15:50:51 +1000 Subject: [PATCH 10/12] Updated NEWS.md for 0.9.6 --- DESCRIPTION | 2 +- NEWS.md | 14 ++++++++++++-- cran-comments.md | 19 +++++++------------ 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 44bf00e..f9d9a05 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,7 +16,7 @@ Authors@R: Description: Clinical coding and diagnosis of patients with kidney using clinical practice guidelines. The guidelines used are the evidence-based KDIGO guidelines. This package covers acute kidney injury (AKI), anemia, - and chronic liver disease(CKD). + and chronic liver disease (CKD). License: MIT + file LICENSE URL: https://github.com/alwinw/epocakir BugReports: https://github.com/alwinw/epocakir/issues diff --git a/NEWS.md b/NEWS.md index ed965f0..66e52d3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,16 @@ -# epocakir 0.9.6 (development version) +# epocakir 0.9.6 -- Preparation for CRAN submission +Initial CRAN submission + +## Improvements + +- Added vignette *Introduction to epocakir* with basic usage examples +- Updated README +- Added sample `clinical_obvs` to demonstrate utility functions + +## Bug fixes + +- Exported `conversion_factors`, similar to ordered factors like `aki_stages` # epocakir 0.9.5 diff --git a/cran-comments.md b/cran-comments.md index e345a5f..a5c5594 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -10,18 +10,13 @@ R CMD check succeeded ## Test Environments -- Windows (Local) - - R version 4.0.3 (2020-10-10), Windows 10 x64, x86_64, mingw32 -- macOS-latest (on GitHub actions) - - R version 4.1.0 (2021-05-18), macOS Catalina 10.15.7, x86_64, darwin17.0 -- Windows-latest (on GitHub actions) - - R version 4.1.0 (2021-05-18), Windows Server x64, x86_64, mingw32 - - R version 3.6.3 (2020-02-29), Windows Server x64, x86_64, mingw32 -- Ubuntu-20.04 (on GitHub actions) - - R version 4.1.0 (2021-05-18), Ubuntu 20.04.2 LTS, x86_64, linux-gnu - - R Under development (unstable) (2021-06-03 r80452), Ubuntu 20.04.2 LTS, x86_64, linux-gnu -- Ubuntu-16.04 (on Github actions) - - R version 3.5.3 (2019-03-11), Ubuntu 16.04.7 LTS, x86_64, linux-gnu +- R version 4.0.3 (2020-10-10), x86_64, mingw32 (Local) +- R version 4.1.0 (2021-05-18), macOS Catalina 10.15.7, x86_64, darwin17.0 (GitHub actions) +- R version 4.1.0 (2021-05-18), Windows Server x64, x86_64, mingw32 (GitHub actions) +- R version 3.6.3 (2020-02-29), Windows Server x64, x86_64, mingw32 (GitHub actions) +- R version 4.1.0 (2021-05-18), Ubuntu 20.04.2 LTS, x86_64, linux-gnu (GitHub actions) +- R Under development (unstable) (2021-06-03 r80452), Ubuntu 20.04.2 LTS, x86_64, linux-gnu (GitHub actions) +- R version 3.5.3 (2019-03-11), Ubuntu 16.04.7 LTS, x86_64, linux-gnu (GitHub actions) ## Revdep checks From 059ab556bffa1ab2a7cc5a4c3f9519c84e5b3658 Mon Sep 17 00:00:00 2001 From: alwinw <16846521+alwinw@users.noreply.github.com> Date: Sun, 6 Jun 2021 15:58:41 +1000 Subject: [PATCH 11/12] Fixed spelling with devtools::spell_check() --- DESCRIPTION | 1 + NEWS.md | 2 +- R/aki.R | 2 +- R/anemia.R | 2 +- R/ckd.R | 2 +- R/data-clinical_obs.R | 2 +- man/aki_staging.Rd | 2 +- man/anemia.Rd | 2 +- man/clinical_obvs.Rd | 2 +- man/eGFR.Rd | 2 +- 10 files changed, 10 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index f9d9a05..a1607e6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -44,3 +44,4 @@ LazyData: true Roxygen: list(markdown = TRUE) RoxygenNote: 7.1.1 VignetteBuilder: knitr +Language: en-US diff --git a/NEWS.md b/NEWS.md index 66e52d3..58524d4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -61,7 +61,7 @@ Initial full-featured release of epocakir methods ## Bug fixes - Used `tibble::tibble()` instead of `data.frame()` to prevent issue with `stringsasfactors` difference between R 3.x and R 4.x -- FIxed sorting error in `aki_UO() +- Fixed sorting error in `aki_UO() # epocakir 0.7.0 diff --git a/R/aki.R b/R/aki.R index bf60d1a..7710875 100644 --- a/R/aki.R +++ b/R/aki.R @@ -24,7 +24,7 @@ aki_stages <- factor( #' The staging (1, 2, 3) of AKI is returned. #' #' When multiple columns are provided, `aki_staging()` will automatically -#' calculate whether or not AKI has occurred using each KDIGIO definition. +#' calculate whether or not AKI has occurred using each KDIGO definition. #' #' \itemize{ #' \item{[`aki_bCr()`]: Staging of AKI based on baseline serum creatinine} diff --git a/R/anemia.R b/R/anemia.R index f0ddfad..3c7341c 100644 --- a/R/anemia.R +++ b/R/anemia.R @@ -17,7 +17,7 @@ #' See for more details. #' #' @param .data (data.frame) A data.frame, optional -#' @param Hb Hemoglobin concenration +#' @param Hb Hemoglobin concentration #' column name, or vector of units or numeric if `.data` is not provided #' @param age Age of patient #' column name, or vector of units or numeric if `.data` is not provided diff --git a/R/ckd.R b/R/ckd.R index 64738b8..d377c85 100644 --- a/R/ckd.R +++ b/R/ckd.R @@ -33,7 +33,7 @@ #' column name, or vector of logical (TRUE/FALSE) if `.data` is not provided #' @param black Black race or not #' column name, or vector of logical (TRUE/FALSE) if `.data` is not provided -#' @param pediatric (logical) Paediatric or not +#' @param pediatric (logical) Pediatric or not #' column name, or vector of logical (TRUE/FALSE) if `.data` is not provided #' @param ... Further optional arguments #' diff --git a/R/data-clinical_obs.R b/R/data-clinical_obs.R index 81359a8..a10119d 100644 --- a/R/data-clinical_obs.R +++ b/R/data-clinical_obs.R @@ -1,6 +1,6 @@ #' Clinical Patient Data #' -#' A sample dataset to demonstrate ulitiy functions in `epocakir` +#' A sample dataset to demonstrate utility functions in `epocakir` #' #' @examples #' clinical_obvs diff --git a/man/aki_staging.Rd b/man/aki_staging.Rd index ca68489..0d4211f 100644 --- a/man/aki_staging.Rd +++ b/man/aki_staging.Rd @@ -54,7 +54,7 @@ Urine Output, \code{aki_staging()} calculates whether or not a patient has AKI. The staging (1, 2, 3) of AKI is returned. When multiple columns are provided, \code{aki_staging()} will automatically -calculate whether or not AKI has occurred using each KDIGIO definition. +calculate whether or not AKI has occurred using each KDIGO definition. \itemize{ \item{\code{\link[=aki_bCr]{aki_bCr()}}: Staging of AKI based on baseline serum creatinine} diff --git a/man/anemia.Rd b/man/anemia.Rd index e0b3075..4027ea0 100644 --- a/man/anemia.Rd +++ b/man/anemia.Rd @@ -20,7 +20,7 @@ anemia(...) \item{.data}{(data.frame) A data.frame, optional} -\item{Hb}{Hemoglobin concenration +\item{Hb}{Hemoglobin concentration column name, or vector of units or numeric if \code{.data} is not provided} \item{age}{Age of patient diff --git a/man/clinical_obvs.Rd b/man/clinical_obvs.Rd index 19d4482..005cae7 100644 --- a/man/clinical_obvs.Rd +++ b/man/clinical_obvs.Rd @@ -11,7 +11,7 @@ An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) w clinical_obvs } \description{ -A sample dataset to demonstrate ulitiy functions in \code{epocakir} +A sample dataset to demonstrate utility functions in \code{epocakir} } \examples{ clinical_obvs diff --git a/man/eGFR.Rd b/man/eGFR.Rd index cfff15b..01c1402 100644 --- a/man/eGFR.Rd +++ b/man/eGFR.Rd @@ -72,7 +72,7 @@ column name, or vector of logical (TRUE/FALSE) if \code{.data} is not provided} \item{black}{Black race or not column name, or vector of logical (TRUE/FALSE) if \code{.data} is not provided} -\item{pediatric}{(logical) Paediatric or not +\item{pediatric}{(logical) Pediatric or not column name, or vector of logical (TRUE/FALSE) if \code{.data} is not provided} } \value{ From a55b68e36d2601e7197ad57678dfa8b9482dca82 Mon Sep 17 00:00:00 2001 From: alwinw <16846521+alwinw@users.noreply.github.com> Date: Sun, 6 Jun 2021 16:52:49 +1000 Subject: [PATCH 12/12] Addressed CMD check comments --- .Rbuildignore | 39 ++++++++++++++++++++------------------- LICENSE | 23 ++--------------------- LICENSE.md | 19 +++++++++++++++++++ NEWS.md | 1 + cran-comments.md | 25 ++++++++++++++++--------- 5 files changed, 58 insertions(+), 49 deletions(-) create mode 100644 LICENSE.md diff --git a/.Rbuildignore b/.Rbuildignore index 9390b44..187b9f8 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,26 +1,27 @@ -^renv$ -^renv\.lock$ -^CRAN-RELEASE$ -^Meta$ -^doc$ +.covrignore +^_pkgdown\.yml$ ^.*\.Rproj$ -^\.Rproj\.user$ -^packrat/ +^.pytest_cache +^\.github$ +^\.png$ ^\.Rprofile$ +^\.Rproj\.user$ ^\.travis\.yml$ -^README\.Rmd$ -^README\.md$ -^README-.*\.png$ ^appveyor\.yml$ -^cran-comments.md$ -^\.png$ -^README_cache/ ^codecov\.yml$ -.covrignore -^resources$ -^_pkgdown\.yml$ +^cran-comments.md$ +^CRAN-RELEASE$ +^data-raw$ +^doc$ ^docs$ +^LICENSE\.md$ +^Meta$ +^packrat/ ^pkgdown$ -^\.github$ -^data-raw$ -^.pytest_cache +^README_cache/ +^README-.*\.png$ +^README\.md$ +^README\.Rmd$ +^renv\.lock$ +^renv$ +^resources$ diff --git a/LICENSE b/LICENSE index d01e40b..15466f0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,2 @@ -# MIT License - -Copyright (c) 2021 Alwin Wang, Lisa Toh - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +YEAR: 2020 +COPYRIGHT HOLDER: Alwin Wang, Lisa Toh \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..6ee7f9d --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,19 @@ +Copyright (c) 2020 Alwin Wang, Lisa Toh + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/NEWS.md b/NEWS.md index 58524d4..3318a89 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,6 +11,7 @@ Initial CRAN submission ## Bug fixes - Exported `conversion_factors`, similar to ordered factors like `aki_stages` +- Corrected mis-spelled words # epocakir 0.9.5 diff --git a/cran-comments.md b/cran-comments.md index a5c5594..4b0e862 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -4,19 +4,26 @@ Initial release of `epocakir` v0.9.6 ## R CMD check results -0 errors v | 0 warnings v | 0 notes v +> checking CRAN incoming feasibility ... NOTE + Maintainer: 'Alwin Wang ' -R CMD check succeeded + New submission + +0 errors √ | 0 warnings √ | 1 note x + +- Note due to new submission +- Note possibly mis-spelled words 'AKI', 'CKD', 'KDIGO', are all medical abbreviations spelt correctly ## Test Environments -- R version 4.0.3 (2020-10-10), x86_64, mingw32 (Local) -- R version 4.1.0 (2021-05-18), macOS Catalina 10.15.7, x86_64, darwin17.0 (GitHub actions) -- R version 4.1.0 (2021-05-18), Windows Server x64, x86_64, mingw32 (GitHub actions) -- R version 3.6.3 (2020-02-29), Windows Server x64, x86_64, mingw32 (GitHub actions) -- R version 4.1.0 (2021-05-18), Ubuntu 20.04.2 LTS, x86_64, linux-gnu (GitHub actions) -- R Under development (unstable) (2021-06-03 r80452), Ubuntu 20.04.2 LTS, x86_64, linux-gnu (GitHub actions) -- R version 3.5.3 (2019-03-11), Ubuntu 16.04.7 LTS, x86_64, linux-gnu (GitHub actions) +- Local Windows 10 install: R 4.0.3 + +- macOS Catalina (GitHub Actions): R 4.1.0 +- Windows Server (GitHub Actions): R 4.1.0, R 3.6.3, +- Ubuntu 20.04.2 (GitHub Actions): R-devel, 4.1.0 +- Ubuntu 16.04.7 (GitHub Actions): R 3.5.3 + +- win-builder: R-devel, R-release, R-oldrelease ## Revdep checks