diff --git a/R/aucint.R b/R/aucint.R index b8aebf86..806e00bb 100644 --- a/R/aucint.R +++ b/R/aucint.R @@ -60,9 +60,9 @@ pk.calc.aucint <- function(conc, time, interval <- assert_intervaltime_single(interval = interval, start = start, end = end) missing_times <- if (is.infinite(interval[2])) { - setdiff(c(interval[1], time.dose), data$time) + setdiff(c(interval[1], time.dose), c(data$time, NA)) } else { - setdiff(c(interval, time.dose), data$time) + setdiff(c(interval, time.dose), c(data$time, NA)) } # Handle the potential double-calculation (before/after tlast) with AUCinf conc_clast <- NULL diff --git a/tests/testthat/test-pk.calc.all.R b/tests/testthat/test-pk.calc.all.R index 084e5843..473273d0 100644 --- a/tests/testthat/test-pk.calc.all.R +++ b/tests/testthat/test-pk.calc.all.R @@ -766,3 +766,20 @@ test_that("Cannot include and exclude half-life points at the same time (#406)", regexp = "Cannot both include and exclude half-life points for the same interval" ) }) + +test_that("all parameters can be calculated (#367)", { + d_conc <- data.frame(conc = 2^(0:-5), time = 0:5) + + o_conc <- PKNCAconc(d_conc, conc~time) + all_param_names <- names(get.interval.cols()) + all_params <- + as.data.frame( + setNames(as.list(rep(TRUE, length(all_param_names))), all_param_names) + ) + all_params$start <- 0 + all_params$end <- Inf + # Parameters that do not work right now + all_params$aucint.last <- FALSE + o_data <- PKNCAdata(o_conc, intervals = all_params) + expect_error(o_nca <- pk.nca(o_data), NA) +})