From 4275530843a16e5f655c1d153aac26eb86f943bf Mon Sep 17 00:00:00 2001 From: StefanThoma <40463122+StefanThoma@users.noreply.github.com> Date: Thu, 3 Aug 2023 08:01:03 +0200 Subject: [PATCH 1/7] code updated --- NEWS.md | 2 ++ R/compute_kidney.R | 33 ++++++++++++++++++---------- tests/testthat/test-compute_kidney.R | 18 +++++++++++---- vignettes/pk_adnca.Rmd | 4 ++-- 4 files changed, 40 insertions(+), 17 deletions(-) diff --git a/NEWS.md b/NEWS.md index d5103d24e4..16eb55b810 100644 --- a/NEWS.md +++ b/NEWS.md @@ -34,6 +34,8 @@ - The arguments `dataset_adsl` in the function `derive_param_exist_flag()` and `subject_keys` have been deprecated versions using the next phase of the deprecation process. (#1950) +- The argument `wt` in the function `compute_egfr()` was deprecated in favor of `weight` using the first phase of the deprecation process. (#2020) + - The `filter` argument in `derive_extreme_records()` was deprecated in favor of the `filter_add` using the next phase of the deprecation process. (#1950) diff --git a/R/compute_kidney.R b/R/compute_kidney.R index ab0a687859..6f7d1011b3 100644 --- a/R/compute_kidney.R +++ b/R/compute_kidney.R @@ -20,7 +20,7 @@ #' #' A numeric vector is expected. #' -#' @param wt Weight (kg) +#' @param weight Weight (kg) #' #' A numeric vector is expected if `method = "CRCL"` #' @@ -42,6 +42,8 @@ #' #' Expected Values: `"CRCL"`, `"CKD-EPI"`, `"MDRD"` #' +#' @param wt *Deprecated*, please use `weight` instead. +#' #' @details #' #' Calculates an estimate of Glomerular Filtration Rate (eGFR) @@ -92,7 +94,7 @@ #' #' @examples #' compute_egfr( -#' creat = 90, creatu = "umol/L", age = 53, wt = 85, sex = "M", method = "CRCL" +#' creat = 90, creatu = "umol/L", age = 53, weight = 85, sex = "M", method = "CRCL" #' ) #' #' compute_egfr( @@ -120,19 +122,28 @@ #' base %>% #' dplyr::mutate( #' CRCL_CG = compute_egfr( -#' creat = CREATBL, creatu = CREATBLU, age = AGE, wt = WTBL, sex = SEX, +#' creat = CREATBL, creatu = CREATBLU, age = AGE, weight = WTBL, sex = SEX, #' method = "CRCL" #' ), #' EGFR_EPI = compute_egfr( -#' creat = CREATBL, creatu = CREATBLU, age = AGE, wt = WTBL, sex = SEX, +#' creat = CREATBL, creatu = CREATBLU, age = AGE, weight = WTBL, sex = SEX, #' method = "CKD-EPI" #' ), #' EGFR_MDRD = compute_egfr( -#' creat = CREATBL, creatu = CREATBLU, age = AGE, wt = WTBL, sex = SEX, +#' creat = CREATBL, creatu = CREATBLU, age = AGE, weight = WTBL, sex = SEX, #' race = RACE, method = "MDRD" #' ), #' ) -compute_egfr <- function(creat, creatu = "SI", age, wt, sex, race = NULL, method) { +compute_egfr <- function(creat, creatu = "SI", age, weight, sex, race = NULL, method, wt) { + + ### BEGIN DEPRECATION + if (!missing(wt)) { + deprecate_warn("0.12.0", "compute_egfr(old_param = 'wt')", "compute_egfr(new_param = 'weight')") + # old_param is given using exprs() + weight <- wt + } + ### END DEPRECATION + assert_numeric_vector(creat) assert_character_vector(creatu, values = c( "SI", "CV", "mg/dL", "umol/L", NA_character_, @@ -164,15 +175,15 @@ compute_egfr <- function(creat, creatu = "SI", age, wt, sex, race = NULL, method sex == "M" ~ 175 * (scr^-1.154) * (age^-0.203) ) } else if (method == "CRCL") { - assert_numeric_vector(wt) + assert_numeric_vector(weight) egfr <- case_when( tolower(creatu) %in% c("cv", "mg/dl") & sex == "F" ~ - ((140 - age) * wt * 0.85) / (creat * 72), + ((140 - age) * weight * 0.85) / (creat * 72), tolower(creatu) %in% c("cv", "mg/dl") & sex == "M" ~ - ((140 - age) * wt) / (creat * 72), - sex == "F" ~ ((140 - age) * wt * 1.04) / creat, - sex == "M" ~ ((140 - age) * wt * 1.23) / creat + ((140 - age) * weight) / (creat * 72), + sex == "F" ~ ((140 - age) * weight * 1.04) / creat, + sex == "M" ~ ((140 - age) * weight * 1.23) / creat ) } else if (method == "CKD-EPI") { kappa <- case_when( diff --git a/tests/testthat/test-compute_kidney.R b/tests/testthat/test-compute_kidney.R index 426fe80da2..f5e1dedc1f 100644 --- a/tests/testthat/test-compute_kidney.R +++ b/tests/testthat/test-compute_kidney.R @@ -27,7 +27,7 @@ test_that("compute_egfr Test 3: CRCL calculation", { # CRCL Cockcroft and Gault (1973) calculator at # https://www.kidney.org/professionals/kdoqi/gfr_calculatorCoc expect_equal(round(compute_egfr( - creat = 1.09, creatu = "mg/dL", age = 55, sex = "M", wt = 90, method = "CRCL" + creat = 1.09, creatu = "mg/dL", age = 55, sex = "M", weight = 90, method = "CRCL" ), 0L), 97) }) @@ -38,7 +38,7 @@ test_that("compute_egfr Test 4: CRCL calculation", { # CRCL Cockcroft and Gault (1973) calculator at # https://www.kidney.org/professionals/kdoqi/gfr_calculatorCoc expect_equal(round(compute_egfr( - creat = 85, creatu = "umol/L", age = 65, sex = "F", wt = 60, method = "CRCL" + creat = 85, creatu = "umol/L", age = 65, sex = "F", weight = 60, method = "CRCL" ), 0L), 55) }) @@ -49,7 +49,7 @@ test_that("compute_egfr Test 5: EGFR MDRD calculation", { # MDRD GFR calculator at # https://www.mdcalc.com/calc/76/mdrd-gfr-equation expect_equal(round(compute_egfr( - creat = 1.09, creatu = "mg/dL", age = 55, sex = "M", wt = 90, race = "WHITE", + creat = 1.09, creatu = "mg/dL", age = 55, sex = "M", weight = 90, race = "WHITE", method = "MDRD" ), 1L), 70.2) }) @@ -87,7 +87,7 @@ test_that("compute_egfr Test 7: CKD-EPI calculated on input data", { egfr <- input %>% dplyr::mutate( EGFR = compute_egfr( - creat = CREATBL, creatu = CREATBLU, age = AGE, wt = WTBL, sex = SEX, + creat = CREATBL, creatu = CREATBLU, age = AGE, weight = WTBL, sex = SEX, method = "CKD-EPI" ), EGFR = round(EGFR, 4L) @@ -99,3 +99,13 @@ test_that("compute_egfr Test 7: CKD-EPI calculated on input data", { keys = c("USUBJID") ) }) + +## Test 8: Deprecate wt ---- +test_that("compute_egfr Test 8: 'wt' argument deprecation warning", { + # expect deprecation warning + expect_warning( + compute_egfr( + creat = 1.09, creatu = "mg/dL", age = 55, sex = "M", wt = 90, method = "CRCL" + ) + ) +}) diff --git a/vignettes/pk_adnca.Rmd b/vignettes/pk_adnca.Rmd index df24f633f8..b03675367e 100644 --- a/vignettes/pk_adnca.Rmd +++ b/vignettes/pk_adnca.Rmd @@ -1377,11 +1377,11 @@ covar_vslb <- covar %>% ), # Derive CRCLBL and EGFRBL using new function CRCLBL = compute_egfr( - creat = CREATBL, creatu = "SI", age = AGE, wt = WTBL, sex = SEX, + creat = CREATBL, creatu = "SI", age = AGE, weight = WTBL, sex = SEX, method = "CRCL" ), EGFRBL = compute_egfr( - creat = CREATBL, creatu = "SI", age = AGE, wt = WTBL, sex = SEX, + creat = CREATBL, creatu = "SI", age = AGE, weight = WTBL, sex = SEX, method = "CKD-EPI" ) ) %>% From 4bf63fdd535b1e56cd39dd37c6258ed24fc692af Mon Sep 17 00:00:00 2001 From: StefanThoma <40463122+StefanThoma@users.noreply.github.com> Date: Thu, 3 Aug 2023 10:23:10 +0200 Subject: [PATCH 2/7] Chore #2020 go through checklist --- R/compute_kidney.R | 1 - docs/pkgdown.yml | 8 ++++---- man/compute_egfr.Rd | 14 ++++++++------ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/R/compute_kidney.R b/R/compute_kidney.R index 6f7d1011b3..3d06062b56 100644 --- a/R/compute_kidney.R +++ b/R/compute_kidney.R @@ -135,7 +135,6 @@ #' ), #' ) compute_egfr <- function(creat, creatu = "SI", age, weight, sex, race = NULL, method, wt) { - ### BEGIN DEPRECATION if (!missing(wt)) { deprecate_warn("0.12.0", "compute_egfr(old_param = 'wt')", "compute_egfr(new_param = 'weight')") diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 2e9fb51fe5..6620ae20d1 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,4 +1,4 @@ -pandoc: 2.11.4 +pandoc: 3.1.1 pkgdown: 2.0.7 pkgdown_sha: ~ articles: @@ -19,8 +19,8 @@ articles: queries_dataset: queries_dataset.html questionnaires: questionnaires.html visits_periods: visits_periods.html -last_built: 2023-07-19T10:42Z +last_built: 2023-08-03T06:39Z urls: - reference: https://pharmaverse.github.io/admiral/cran-release/reference/ - article: https://pharmaverse.github.io/admiral/cran-release/articles/ + reference: https://pharmaverse.github.io/admiral/reference + article: https://pharmaverse.github.io/admiral/articles diff --git a/man/compute_egfr.Rd b/man/compute_egfr.Rd index db34c29df7..746f387d8f 100644 --- a/man/compute_egfr.Rd +++ b/man/compute_egfr.Rd @@ -4,7 +4,7 @@ \alias{compute_egfr} \title{Compute Estimated Glomerular Filtration Rate (eGFR) for Kidney Function} \usage{ -compute_egfr(creat, creatu = "SI", age, wt, sex, race = NULL, method) +compute_egfr(creat, creatu = "SI", age, weight, sex, race = NULL, method, wt) } \arguments{ \item{creat}{Creatinine @@ -23,7 +23,7 @@ Expected Values: \code{"SI"}, \code{"CV"}, \code{"umol/L"}, \code{"mg/dL"}} A numeric vector is expected.} -\item{wt}{Weight (kg) +\item{weight}{Weight (kg) A numeric vector is expected if \code{method = "CRCL"}} @@ -44,6 +44,8 @@ Expected Values: \code{"BLACK OR AFRICAN AMERICAN"} and others} A character vector is expected. Expected Values: \code{"CRCL"}, \code{"CKD-EPI"}, \code{"MDRD"}} + +\item{wt}{\emph{Deprecated}, please use \code{weight} instead.} } \value{ A numeric vector of egfr values @@ -97,7 +99,7 @@ units = mL/min/1.73 m2 } \examples{ compute_egfr( - creat = 90, creatu = "umol/L", age = 53, wt = 85, sex = "M", method = "CRCL" + creat = 90, creatu = "umol/L", age = 53, weight = 85, sex = "M", method = "CRCL" ) compute_egfr( @@ -125,15 +127,15 @@ base <- tibble::tribble( base \%>\% dplyr::mutate( CRCL_CG = compute_egfr( - creat = CREATBL, creatu = CREATBLU, age = AGE, wt = WTBL, sex = SEX, + creat = CREATBL, creatu = CREATBLU, age = AGE, weight = WTBL, sex = SEX, method = "CRCL" ), EGFR_EPI = compute_egfr( - creat = CREATBL, creatu = CREATBLU, age = AGE, wt = WTBL, sex = SEX, + creat = CREATBL, creatu = CREATBLU, age = AGE, weight = WTBL, sex = SEX, method = "CKD-EPI" ), EGFR_MDRD = compute_egfr( - creat = CREATBL, creatu = CREATBLU, age = AGE, wt = WTBL, sex = SEX, + creat = CREATBL, creatu = CREATBLU, age = AGE, weight = WTBL, sex = SEX, race = RACE, method = "MDRD" ), ) From abcaecf94b6fc03369061d3436d9d58ffa44edc9 Mon Sep 17 00:00:00 2001 From: StefanThoma <40463122+StefanThoma@users.noreply.github.com> Date: Thu, 3 Aug 2023 14:43:07 +0200 Subject: [PATCH 3/7] update .lycheeignore --- .lycheeignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.lycheeignore b/.lycheeignore index 5774d2a153..e0601dfa65 100644 --- a/.lycheeignore +++ b/.lycheeignore @@ -3,3 +3,5 @@ https://github.com/pharmaverse/admiral/blob/main/ https://github.com/pharmaverse/admiral/blob/main/inst/templates/ad_adxx.R irongut/CodeCoverageSummary@v1.2.0 https://packagemanager.rstudio.com/cran/__linux__/focal/latest +https://pharmaverse.github.io/admiral/reference](https://pharmaverse.github.io/admiral/reference +https://pharmaverse.github.io/admiral/articles](https://pharmaverse.github.io/admiral/articles From 9c3e9f7b26b9feeffc1e8eeee52644996465d6df Mon Sep 17 00:00:00 2001 From: StefanThoma <40463122+StefanThoma@users.noreply.github.com> Date: Thu, 3 Aug 2023 14:43:07 +0200 Subject: [PATCH 4/7] update .lycheeignore --- .lycheeignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.lycheeignore b/.lycheeignore index 5774d2a153..f9def1165e 100644 --- a/.lycheeignore +++ b/.lycheeignore @@ -3,3 +3,5 @@ https://github.com/pharmaverse/admiral/blob/main/ https://github.com/pharmaverse/admiral/blob/main/inst/templates/ad_adxx.R irongut/CodeCoverageSummary@v1.2.0 https://packagemanager.rstudio.com/cran/__linux__/focal/latest +https://pharmaverse.github.io/admiral/reference +https://pharmaverse.github.io/admiral/articles From 73c144458584a6ab7b051bd6e5a89f8e91ebb8fc Mon Sep 17 00:00:00 2001 From: StefanThoma <40463122+StefanThoma@users.noreply.github.com> Date: Fri, 4 Aug 2023 14:53:21 +0200 Subject: [PATCH 5/7] adjusted templates --- inst/templates/ad_adppk.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inst/templates/ad_adppk.R b/inst/templates/ad_adppk.R index ea4ceb122b..7d69820370 100644 --- a/inst/templates/ad_adppk.R +++ b/inst/templates/ad_adppk.R @@ -448,11 +448,11 @@ covar_vslb <- covar %>% method = "Mosteller" ), CRCLBL = compute_egfr( - creat = CREATBL, creatu = "SI", age = AGE, wt = WTBL, sex = SEX, + creat = CREATBL, creatu = "SI", age = AGE, weight = WTBL, sex = SEX, method = "CRCL" ), EGFRBL = compute_egfr( - creat = CREATBL, creatu = "SI", age = AGE, wt = WTBL, sex = SEX, + creat = CREATBL, creatu = "SI", age = AGE, weight = WTBL, sex = SEX, method = "CKD-EPI" ) ) %>% From dd93e3f68dea5f353a67a2f052d8e65a1a683820 Mon Sep 17 00:00:00 2001 From: StefanThoma <40463122+StefanThoma@users.noreply.github.com> Date: Wed, 9 Aug 2023 15:37:57 +0200 Subject: [PATCH 6/7] chore: removed links from .lycheeignore --- .lycheeignore | 2 -- docs/pkgdown.yml | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.lycheeignore b/.lycheeignore index f9def1165e..5774d2a153 100644 --- a/.lycheeignore +++ b/.lycheeignore @@ -3,5 +3,3 @@ https://github.com/pharmaverse/admiral/blob/main/ https://github.com/pharmaverse/admiral/blob/main/inst/templates/ad_adxx.R irongut/CodeCoverageSummary@v1.2.0 https://packagemanager.rstudio.com/cran/__linux__/focal/latest -https://pharmaverse.github.io/admiral/reference -https://pharmaverse.github.io/admiral/articles diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 6620ae20d1..3a4645246c 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -19,8 +19,8 @@ articles: queries_dataset: queries_dataset.html questionnaires: questionnaires.html visits_periods: visits_periods.html -last_built: 2023-08-03T06:39Z +last_built: 2023-08-07T09:14Z urls: - reference: https://pharmaverse.github.io/admiral/reference - article: https://pharmaverse.github.io/admiral/articles + reference: https://pharmaverse.github.io/admiral/cran-release/reference/ + article: https://pharmaverse.github.io/admiral/cran-release/articles/ From 0ed1371ba4d51ccd9fe55a975054872dd38c493d Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Thu, 10 Aug 2023 16:30:10 -0400 Subject: [PATCH 7/7] chore: #2020 removing file --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6887dd7f14..aedad7715d 100644 --- a/.gitignore +++ b/.gitignore @@ -40,7 +40,6 @@ vignettes/*.pdf # website documents /docs/* -!/docs/pkgdown.yml doc Meta admiral.Rcheck/