Skip to content

Commit

Permalink
refactor warning
Browse files Browse the repository at this point in the history
  • Loading branch information
roninsightrx committed Jul 5, 2024
1 parent 1de20fb commit bdf38bc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions R/regimen_to_nm.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ regimen_to_nm <- function(
suppressWarnings(
bioav_dose <- as.numeric(bioav[dose_cmt])
)
if(!any(is.na(bioav_dose))) {
if(!all(bioav_dose == 1)) {
dat$RATE <- dat$RATE * bioav_dose
message("Recalculating infusion rates to reflect bioavailability for infusion.")
non_na_biov_dose <- !is.na(bioav_dose)
if(any(is.na(bioav_dose))) {
if(any(is.na(bioav_dose) & reg$t_inf > 0)) { # only warn when it actually concerns an infusion
warning("For compartments where bioavailability is specified as model parameter and not as a number, any infusion rates are not corrected for bioavailability.")
}
} else {
warning("Bioavailability not specified correctly, cannot correct infusion rates.")
bioav_dose[is.na(bioav_dose)] <- 1
}
dat$RATE <- dat$RATE * bioav_dose
message("Recalculating infusion rates to reflect bioavailability for infusion.")
}
}
if(!is.null(t_obs)) {
Expand Down

0 comments on commit bdf38bc

Please sign in to comment.