-
Notifications
You must be signed in to change notification settings - Fork 29
PPANMETH in pk.nca output #469
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
base: main
Are you sure you want to change the base?
Changes from 13 commits
c2f8e17
32b19a3
e17ab38
f75865d
0e7de7a
2b4c1b5
ec03c2c
7ea493d
6fb8505
91d4975
e632ed7
e7a1145
9bf05d0
b5ce26b
3be8500
6a0e7d3
eae9721
d3095e2
4dd25c3
8fb9d99
c6ab60a
1c45fe3
d03e2eb
d8f1877
f48cb19
521fcf9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,12 +10,12 @@ | |
| #' the interval. For example, if an interval starts at 168 hours, ends at 192 | ||
| #' hours, and and the maximum concentration is at 169 hours, `tmax=169-168=1`. | ||
| #' | ||
| #' @param data A PKNCAdata object | ||
| #' @param verbose Indicate, by `message()`, the current state of calculation. | ||
| #' @returns A `PKNCAresults` object. | ||
| #' @seealso [PKNCAdata()], [PKNCA.options()], [summary.PKNCAresults()], | ||
| #' [as.data.frame.PKNCAresults()], [exclude()] | ||
| #' @export | ||
| ##' @param data A PKNCAdata object | ||
| ##' @param verbose Indicate, by `message()`, the current state of calculation. | ||
| ##' @returns A `PKNCAresults` object. | ||
| ##' @seealso [PKNCAdata()], [PKNCA.options()], [summary.PKNCAresults()], | ||
| ##' [as.data.frame.PKNCAresults()], [exclude()] | ||
| ##' @export | ||
| pk.nca <- function(data, verbose=FALSE) { | ||
| assert_PKNCAdata(data) | ||
| results <- data.frame() | ||
|
|
@@ -363,6 +363,7 @@ pk.nca.interval <- function(conc, time, volume, duration.conc, | |
| if (nrow(interval) != 1) { | ||
| stop("Please report a bug. Interval must be a one-row data.frame") | ||
| } | ||
|
|
||
| if (!all(is.na(impute_method))) { | ||
| impute_funs <- PKNCA_impute_fun_list(impute_method) | ||
| stopifnot(length(impute_funs) == 1) | ||
|
|
@@ -378,6 +379,11 @@ pk.nca.interval <- function(conc, time, volume, duration.conc, | |
| } | ||
| conc <- impute_data$conc | ||
| time <- impute_data$time | ||
| tmp_imp_method <- c( | ||
| paste0("Imputation: ", paste(na.omit(impute_method), collapse = ", ")) | ||
| ) | ||
| } else { | ||
| tmp_imp_method <- c() | ||
billdenney marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| # Prepare the return value using SDTM names | ||
| ret <- data.frame(PPTESTCD=NA, PPORRES=NA)[-1,] | ||
|
|
@@ -399,6 +405,7 @@ pk.nca.interval <- function(conc, time, volume, duration.conc, | |
| } | ||
| # Do the calculations | ||
| for (n in names(all_intervals)) { | ||
| tmp_method <- c(tmp_imp_method) | ||
billdenney marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| request_to_calculate <- as.logical(interval[[n]]) | ||
| has_calculation_function <- !is.na(all_intervals[[n]]$FUN) | ||
| is_correct_sparse_dense <- all_intervals[[n]]$sparse == sparse | ||
|
|
@@ -485,6 +492,7 @@ pk.nca.interval <- function(conc, time, volume, duration.conc, | |
| } | ||
| } | ||
| } | ||
|
|
||
| # Apply manual inclusion and exclusion | ||
| if (n %in% "half.life") { | ||
| if (!is.null(include_half.life) && !all(is.na(include_half.life))) { | ||
|
|
@@ -498,6 +506,26 @@ pk.nca.interval <- function(conc, time, volume, duration.conc, | |
| call_args$time <- call_args$time[!exclude_tf] | ||
| } | ||
| } | ||
| # For half-life related parameters, indicate if there was any manual inclusion / exclusion | ||
|
||
| if (n %in% get.parameter.deps("half.life")) { | ||
| any_inclusion <- !is.null(include_half.life) && !all(is.na(include_half.life)) | ||
| any_exclusion <- !is.null(exclude_half.life) && !all(is.na(exclude_half.life)) | ||
| tmp_method <- c( | ||
| tmp_method, | ||
| paste0( | ||
| "Lambda Z: ", | ||
| {if (any_inclusion) "Manual selection" else if (any_exclusion) "Manual exclusion" else "Default"} | ||
| ) | ||
| ) | ||
| } | ||
| # For AUC parameters, indicate the calculation method | ||
| auc_parameters <- grep("auc", names(get.interval.cols()), value = TRUE) | ||
| if (n %in% auc_parameters) { | ||
| tmp_method <- c( | ||
| tmp_method, | ||
| paste0("AUC: ", options$auc.method) | ||
| ) | ||
| } | ||
| # Do the calculation | ||
| tmp_result <- do.call(all_intervals[[n]]$FUN, call_args) | ||
| # The handling of the exclude column is documented in the | ||
|
|
@@ -548,6 +576,7 @@ pk.nca.interval <- function(conc, time, volume, duration.conc, | |
| data.frame( | ||
| PPTESTCD=tmp_testcd, | ||
| PPORRES=tmp_result, | ||
| PPANMETH=paste(tmp_method, collapse=". "), | ||
| exclude=exclude_reason, | ||
| stringsAsFactors=FALSE | ||
| ) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.