-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Hello PKNCA team!
In aNCA we developed some impute_start functions that I feel are very standard/intuitive:
PKNCA_impute_method_start_logslope <- function(conc, time, start, end, ..., options = list()) { # nolint
ret <- data.frame(conc = conc, time = time)
mask_start <- time %in% start
if (!any(mask_start)) {
all_concs <- conc[time >= start & time <= end]
all_times <- time[time >= start & time <= end]
if (!all(is.na(all_concs))) {
c0 <- PKNCA::pk.calc.c0(all_concs, all_times, method = "logslope")
if (!is.na(c0)) {
ret <- rbind(ret, data.frame(time = start, conc = c0))
ret <- ret[order(ret$time), ]
}
}
}
ret
}
PKNCA_impute_method_start_c1 <- function(conc, time, start, end, ..., options = list()) { # nolint
ret <- data.frame(conc = conc, time = time)
mask_start <- time %in% start
if (!any(mask_start)) {
all_concs <- conc[time >= start & time <= end]
all_times <- time[time >= start & time <= end]
if (!all(is.na(all_concs))) {
c1 <- all_concs[which.min(all_times)]
ret <- rbind(ret, data.frame(time = start, conc = c1))
ret <- ret[order(ret$time), ]
}
}
ret
}
Feel free to give a look to the pr to check the tests+documentation and merge if the functions could be of interest to you!
#351
If they are useless feel free to close the issue and pull request!
Metadata
Metadata
Assignees
Labels
No labels