Skip to content
Open
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 CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 0.12.1
Date: 2025-08-19 00:38:37 UTC
SHA: 68c5803de01dfc6cc8e43cfdf649de69e38b2a85
Version: 0.12.2
Date: 2026-03-23 14:03:31 UTC
SHA: 3c048da92711ddc75d121a3c654073e20878b132
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: PKNCA
Type: Package
Title: Perform Pharmacokinetic Non-Compartmental Analysis
Version: 0.12.1.9000
Version: 0.12.2
Authors@R: c(
person("Bill", "Denney", email="wdenney@humanpredictions.com", role=c("aut", "cre"), comment=c(ORCID="0000-0002-5759-428X")),
person("Clare", "Buckeridge", email="clare.buckeridge@pfizer.com", role="aut"),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ will continue until then. These will be especially noticeable around
the inclusion of IV NCA parameters and additional specifications of
the dosing including dose amount and route.

# Development version
# PKNCA 0.12.2

## Breaking changes

Expand Down
18 changes: 9 additions & 9 deletions R/half.life.R
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,18 @@ pk.calc.half.life <- function(conc, time, tmax, tlast,
)
half_lives_for_selection <-
half_lives_for_selection[order(-half_lives_for_selection$lambda.z.time.first), ]
# Pre-build the two-column data.frame that fit_half_life expects. The rows
# are already in descending-time order (matching half_lives_for_selection).
# Subsetting a pre-built data.frame avoids constructing a new data.frame on
# every loop iteration.
dfK_for_fit <- data.frame(
log_conc = half_lives_for_selection$log_conc,
time = half_lives_for_selection$lambda.z.time.first
)
for(i in min.hl.points:nrow(half_lives_for_selection)) {
# Fit the terminal slopes until the adjusted r-squared value
# is not improving (or it only gets worse by a small factor).
fit <-
fit_half_life(
data=
data.frame(
log_conc=half_lives_for_selection$log_conc[1:i],
time=half_lives_for_selection$lambda.z.time.first[1:i]
),
tlast=ret$tlast
)
fit <- fit_half_life(data=dfK_for_fit[seq_len(i), , drop=FALSE], tlast=ret$tlast)
half_lives_for_selection[i,names(fit)] <- fit
}
# Find the best model
Expand Down
12 changes: 8 additions & 4 deletions R/pk.calc.all.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ pk.nca.intervals <- function(data_conc, data_dose, data_intervals, sparse,
# No intervals; potentially placebo data
return(rlang::warning_cnd(class="pknca_no_intervals", message="No intervals for data"))
}
ret <- data.frame()
# Hoist the debug check: options is already the fully-merged options object
# (merged at the top of pk.nca()), so there is no need to re-query
# PKNCA.options() from the environment on every iteration.
use_debug <- !is.null(options$debug)
ret_list <- list()
for (i in seq_len(nrow(data_intervals))) {
current_interval <- data_intervals[i, , drop=FALSE]
has_calc_sparse_dense <- any_sparse_dense_in_interval(current_interval, sparse=sparse)
Expand Down Expand Up @@ -279,7 +283,7 @@ pk.nca.intervals <- function(data_conc, data_dose, data_intervals, sparse,
stop("Cannot both include and exclude half-life points for the same interval")
}
# Try the calculation
if (!is.null(PKNCA.options()$debug)) {
if (use_debug) {
# debugging mode does not need coverage
calculated_interval <- do.call(pk.nca.interval, args) # nocov
} else {
Expand All @@ -304,10 +308,10 @@ pk.nca.intervals <- function(data_conc, data_dose, data_intervals, sparse,
calculated_interval,
row.names=NULL
)
ret <- rbind(ret, new_ret)
ret_list[[length(ret_list) + 1L]] <- new_ret
}
}
ret
if (length(ret_list) == 0L) data.frame() else dplyr::bind_rows(ret_list)
}

#' Compute all PK parameters for a single concentration-time data set
Expand Down
5 changes: 5 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## R CMD check results

0 errors | 0 warnings | 1 note

* Fixed URI error noted in prior submission
2 changes: 1 addition & 1 deletion vignettes/v01-introduction-and-usage.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ minimum-required number of calculations for the data that are changed.
To use `update()`, give it your existing results and the new `PKNCAdata` object
you want to use.

Starting from the theophylline example in the [Quick Start](Quick Start) section above:
Starting from the theophylline example in the [Quick Start](#quick-start) section above:

```{r update-example-setup}
d_conc <- as.data.frame(datasets::Theoph)
Expand Down
Loading