Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

submit to CRAN #38

Merged
merged 11 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: clinPK
Type: Package
Title: Clinical Pharmacokinetics Toolkit
Version: 0.10.13
Date: 2022-03-01
Version: 0.11.1
Date: 2022-05-06
Authors@R: c(person("Ron", "Keizer", email = "ron@insight-rx.com", role
= "aut"), person("Jasmine", "Hughes", email =
"jasmine@insight-rx.com", role = "aut"), person("Dominic",
Expand All @@ -16,8 +16,8 @@ Description: Calculates equations commonly used in clinical
chemistry, and conversion of common clinical parameters. Where
possible and relevant, it provides multiple published and
peer-reviewed equations within the respective R function.
URL: https://github.com/InsightRX/clinPK
License: MIT + file LICENSE
LazyData: TRUE
RoxygenNote: 7.1.2
Suggests: testthat (>= 3.0.0)
Config/testthat/edition: 3
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2021
YEAR: 2022
COPYRIGHT HOLDER: InsightRX
17 changes: 17 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# clinPK 0.11.1

## Major changes
- various corrections in nca() function
- various updates to AKI staging equations: MDRD equation (use 2006 publication), kDIGO and PRIFLE
- added equations of MDRD and CKD-EPI without race

## Minor updates
- refactor of calc_ibw()
- fixed Boyd equation in calc_bsa()
- added function to convert flow units
- updates to 2-sample equation
- added Cockcroft-Gault equation for spinal cord injury patients
- consistent handling of missing/unrecognized data in `calc_ibw()`/`calc_ffm()`/`calc_egfr()`
- various minor fixes and updates
- various documentation updates
- added many unit tests, increase overall coverage to >86%
6 changes: 3 additions & 3 deletions R/calc_aki_stage.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ calc_aki_stage <- function (

if(is.null(scr) && method !='prifle') stop("No serum creatinine values provided.")
if(is.null(times) && method !='prifle') stop("No sample times (days) provided.")
if(class(times) == "Date") {
if(inherits(times, "Date")) {
times <- as.numeric(difftime(times, min(times), units = "days"))
}
if((!class(times[1]) %in% c("numeric","integer")) && method !='prifle') {
if(!inherits(times[1], c("numeric","integer")) && method !='prifle') {
stop("`times` argument should be supplied either as days (numeric) or as Date class.")
}
if(length(scr) != length(times) && method !='prifle') stop("Serum creatinine values and vector of sample times should have same length.")
Expand All @@ -104,7 +104,7 @@ calc_aki_stage <- function (
}
}
# pRIFLE does not require SCr
if(class(baseline_scr) == "character" && method !='prifle') {
if(inherits(baseline_scr, "character") && method !='prifle') {
baseline_scr <- calc_baseline_scr(baseline_scr,
scr,
times,
Expand Down
4 changes: 2 additions & 2 deletions R/calc_baseline_scr.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ calc_baseline_scr <- function(
baseline_scr <- stats::median(scr, na.rm = TRUE)
if(verbose) message("To calculate median baseline before treatment start need time of first dose. Using median over whole treatment period.")
} else {
if((!class(first_dose_time) %in% c("numeric","integer"))) {
if((!inherits(first_dose_time, c("numeric","integer")))) {
stop("`first_dose_times` argument should be supplied as numeric (hours).")
}
if(any(times <= first_dose_time)) {
Expand Down Expand Up @@ -48,7 +48,7 @@ calc_baseline_scr <- function(
if(baseline_scr == "expected" && method !='prifle') {
## TODO: need to implement
}
if(! class(baseline_scr) %in% c("numeric", "integer")) {
if(! inherits(baseline_scr, c("numeric", "integer"))) {
stop("Requested baseline calculation method not recognized.")
}

Expand Down
12 changes: 6 additions & 6 deletions R/calc_egfr.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@
#' @param fail invoke `stop()` if not all covariates available?
#' @param ... arguments passed on to `calc_abw` or `calc_dosing_weight`
#' @references \itemize{
#' \item Cockcroft-Gault: \href{http://www.ncbi.nlm.nih.gov/pubmed/1244564}{Cockcroft & Gault, Nephron (1976)}
#' \item Cockcroft-Gault for spinal cord injury: \href{https://www.ncbi.nlm.nih.gov/pubmed/6835689}{Mirahmadi et al., Paraplegia (1983)}
#' \item Revised Lund-Malmo: \href{http://www.ncbi.nlm.nih.gov/pubmed/24334413}{Nyman et al., Clinical Chemistry and Laboratory Medicine (2014)}
#' \item Cockcroft-Gault: \href{https://pubmed.ncbi.nlm.nih.gov/1244564/}{Cockcroft & Gault, Nephron (1976)}
#' \item Cockcroft-Gault for spinal cord injury: \href{https://pubmed.ncbi.nlm.nih.gov/6835689/}{Mirahmadi et al., Paraplegia (1983)}
#' \item Revised Lund-Malmo: \href{https://pubmed.ncbi.nlm.nih.gov/24334413/}{Nyman et al., Clinical Chemistry and Laboratory Medicine (2014)}
#' \item MDRD: \href{https://pubmed.ncbi.nlm.nih.gov/11706306/}{Manjunath et al., Curr. Opin. Nephrol. Hypertens. (2001)}
#' and \href{https://academic.oup.com/clinchem/article/53/4/766/5627682}{Levey et al., Clinical Chemistry (2007)}. (See Note.)
#' \item CKD-EPI: \href{https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2763564/}{Levey et al., Annals of Internal Medicine (2009)}. (See Note.)
#' \item CKD-EPI (2021): \href{https://www.nejm.org/doi/full/10.1056/NEJMoa2102953}{Inker, et al., NEJM (2021)}.
#' \item Schwartz: \href{https://www.ncbi.nlm.nih.gov/pubmed/951142}{Schwartz et al., Pediatrics (1976)}
#' \item Schwartz revised / bedside: \href{https://www.ncbi.nlm.nih.gov/pubmed/19158356}{Schwartz et al., Journal of the American Society of Nephrology (2009)}
#' \item Jelliffe: \href{https://www.ncbi.nlm.nih.gov/pubmed/4748282}{Jelliffe, Annals of Internal Medicine (1973)}
#' \item Schwartz: \href{https://pubmed.ncbi.nlm.nih.gov/951142/}{Schwartz et al., Pediatrics (1976)}
#' \item Schwartz revised / bedside: \href{https://pubmed.ncbi.nlm.nih.gov/19158356/}{Schwartz et al., Journal of the American Society of Nephrology (2009)}
#' \item Jelliffe: \href{https://pubmed.ncbi.nlm.nih.gov/4748282/}{Jelliffe, Annals of Internal Medicine (1973)}
#' \item Jelliffe for unstable renal function: \href{https://pubmed.ncbi.nlm.nih.gov/12169862/}{Jelliffe, American Journal of Nephrology (2002)}
#' \item Wright: \href{https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2363765/}{Wright et al., British Journal of Cancer (2001)}
#' }
Expand Down
2 changes: 1 addition & 1 deletion R/convert_creat_unit.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
convert_creat_unit <- function(
value = NULL,
unit_in = "mg/dL") {
if(class(value) == "list" && !is.null(value$value) && !is.null(value$unit)) {
if(inherits(value, "list") && !is.null(value$value) && !is.null(value$unit)) {
unit_in <- value$unit
value <- value$value
}
Expand Down
2 changes: 1 addition & 1 deletion R/nca.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ nca <- function (
baseline <- data$dv[1]
}
data_fit <- data
if(class(weights) == "function") { # transform f(y) to vector of weights
if(inherits(weights, "function")) { # transform f(y) to vector of weights
weights <- do.call("weights", args = list(data_fit$dv))
}

Expand Down
4 changes: 2 additions & 2 deletions R/pk_1cmt_t12.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ pk_1cmt_t12 <- function(
V = 30
) {
## conversions, if necessary
if(class(CL) == "list" && !is.null(CL$value)) { CL <- CL$value }
if(class(V) == "list" && !is.null(V$value)) { V <- V$value }
if(inherits(CL, "list") && !is.null(CL$value)) { CL <- CL$value }
if(inherits(V, "list") && !is.null(V$value)) { V <- V$value }
kel <- CL / V
t12 <- log(2) / kel
return(t12)
Expand Down
8 changes: 4 additions & 4 deletions R/pk_2cmt_t12.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ pk_2cmt_t12 <- function(
) {
phase <- match.arg(phase)
## conversions, if necessary
if(class(CL) == "list" && !is.null(CL$value)) { CL <- CL$value }
if(class(V) == "list" && !is.null(V$value)) { V <- V$value }
if(class(Q) == "list" && !is.null(Q$value)) { Q <- Q$value }
if(class(V2) == "list" && !is.null(V2$value)) { V2 <- V2$value }
if(inherits(CL, "list") && !is.null(CL$value)) { CL <- CL$value }
if(inherits(V, "list") && !is.null(V$value)) { V <- V$value }
if(inherits(Q, "list") && !is.null(Q$value)) { Q <- Q$value }
if(inherits(V2, "list") && !is.null(V2$value)) { V2 <- V2$value }
kel <- CL / V
k12 <- Q / V
k21 <- Q / V2
Expand Down
8 changes: 4 additions & 4 deletions R/pk_2cmt_t12_interval.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ pk_2cmt_t12_interval <- function(
t_inf = NULL
) {
## conversions, if necessary
if(class(CL) == "list" && !is.null(CL$value)) { CL <- CL$value }
if(class(V) == "list" && !is.null(V$value)) { V <- V$value }
if(class(Q) == "list" && !is.null(Q$value)) { Q <- Q$value }
if(class(V2) == "list" && !is.null(V2$value)) { V2 <- V2$value }
if(inherits(CL, "list") && !is.null(CL$value)) { CL <- CL$value }
if(inherits(V, "list") && !is.null(V$value)) { V <- V$value }
if(inherits(Q, "list") && !is.null(Q$value)) { Q <- Q$value }
if(inherits(V2, "list") && !is.null(V2$value)) { V2 <- V2$value }
if(!is.null(t_inf)) {
conc <- pk_2cmt_inf_ss(t=c(t_inf, tau), dose = 1000, tau = tau, t_inf = t_inf, CL=CL, V=V, Q=Q, V2=V2)
} else {
Expand Down
60 changes: 40 additions & 20 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,43 @@
## Test environments

* Ubuntu 16.04 (local), R 3.4.0
* Ubuntu 12.04.5 LTS (travis-ci), R 3.4.0
* Windows (CRAN win-builder), R 3.4.0

- R-hub windows-x86_64-devel (r-devel)
- R-hub ubuntu-gcc-release (r-release)
- R-hub fedora-clang-devel (r-devel)
- Winbuilder (r-release)

## R CMD check results

R CMD check results
0 errors | 0 warnings | 0 notes

R CMD check succeeded


## Downstream dependencies

None


## Misc

First submission to CRAN
❯ On windows-x86_64-devel (r-devel), ubuntu-gcc-release (r-release), fedora-clang-devel (r-devel)
checking CRAN incoming feasibility ... NOTE
Maintainer: 'Kara Woo <kara@insight-rx.com>'

New maintainer:
Kara Woo <kara@insight-rx.com>
Old maintainer(s):
Ron Keizer <ronkeizer@gmail.com>

Found the following (possibly) invalid URLs:
URL: https://academic.oup.com/clinchem/article/53/4/766/5627682
From: man/calc_egfr.Rd
Status: 403
Message: Forbidden
URL: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2763564/
From: man/calc_egfr.Rd
Status: 403
Message: Forbidden
URL: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4238883/
From: man/calc_aki_stage.Rd
Status: 403
Message: Forbidden

❯ On windows-x86_64-devel (r-devel)
checking for detritus in the temp directory ... NOTE
Found the following files/directories:
'lastMiKTeXException'

0 errors ✔ | 0 warnings ✔ | 2 notes ✖

## Maintainer notes

This release involves a change in maintainer from Ron Keizer to Kara Woo.

The three URLs that show 403 responses are valid and correct, but forbid
requests with `curl` in the User-Agent header.
12 changes: 6 additions & 6 deletions man/calc_egfr.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.