diff --git a/NAMESPACE b/NAMESPACE index fe851103..3fe2fad2 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +S3method(AIC,list) S3method(PKNCAconc,data.frame) S3method(PKNCAconc,default) S3method(PKNCAconc,tbl_df) diff --git a/NEWS.md b/NEWS.md index 98c8760c..d203cdef 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,9 @@ the dosing including dose amount and route. # Development version +* Parameter descriptions in `add.interval.col()` are now limited to 40 + characters to comply with SDTM requirements. + * Bug fix: `pk.nca()` no longer errors on unsorted concentration-time data. Group-level concentration data are now sorted by time before calculation, so parameters that use the full group (e.g. `aucint.all` and the other `aucint*` diff --git a/R/001-add.interval.col.R b/R/001-add.interval.col.R index bb0de4da..3acbd228 100644 --- a/R/001-add.interval.col.R +++ b/R/001-add.interval.col.R @@ -158,7 +158,7 @@ add.interval.col <- function(name, checkmate::assert_character(x = FUN, len = 1, any.missing = TRUE) # allows NA checkmate::assert_logical(x = sparse, len = 1, any.missing=FALSE) checkmate::assert_character(x = pretty_name, len = 1, min.chars = 1, any.missing=FALSE) - checkmate::assert_character(x = desc, len = 1, any.missing=FALSE) + checkmate::assert_character(x = desc, len = 1, any.missing=FALSE, max.chars = 40) checkmate::assert_character(x = depends, null.ok = TRUE) # `values` must be either a function (used to validate/coerce) or a vector @@ -200,7 +200,7 @@ add.interval.col <- function(name, # Ensure formalsmap names are unique checkmate::assert_character(x = names(formalsmap), min.chars = 1, any.missing = FALSE) } - + # Ensure that the function exists if (!is.na(FUN)) { # Ensure that the function exists @@ -341,5 +341,5 @@ add.interval.col( values = as.numeric, unit_type="time", pretty_name="Interval End", - desc = "Ending time of the interval (potentially infinity)" + desc = "End time of interval (may be Inf)" ) diff --git a/R/auc.R b/R/auc.R index ac92ba4c..95bf73db 100644 --- a/R/auc.R +++ b/R/auc.R @@ -343,7 +343,7 @@ add.interval.col("aucinf.obs", values=c(FALSE, TRUE), unit_type="auc", pretty_name="AUCinf,obs", - desc="The area under the concentration time curve from the beginning of the interval to infinity with extrapolation to infinity from the observed Clast", + desc="AUC start to inf, obs Clast extrap", depends=c("lambda.z", "clast.obs"), pptestcd_cdisc="AUCIFO", pptest_cdisc="AUC Infinity Obs") @@ -353,7 +353,7 @@ add.interval.col("aucinf.pred", values=c(FALSE, TRUE), unit_type="auc", pretty_name="AUCinf,pred", - desc="The area under the concentration time curve from the beginning of the interval to infinity with extrapolation to infinity from the predicted Clast", + desc="AUC start to inf, pred Clast extrap", depends=c("lambda.z", "clast.pred"), pptestcd_cdisc="AUCIFP", pptest_cdisc="AUC Infinity Pred") @@ -363,7 +363,7 @@ add.interval.col("auclast", values=c(FALSE, TRUE), unit_type="auc", pretty_name="AUClast", - desc="The area under the concentration time curve from the beginning of the interval to the last concentration above the limit of quantification", + desc="AUC start to last conc above LOQ", pptestcd_cdisc="AUCLST", pptest_cdisc="AUC to Last Nonzero Conc") @@ -372,7 +372,7 @@ add.interval.col("aucall", values=c(FALSE, TRUE), unit_type="auc", pretty_name="AUCall", - desc="The area under the concentration time curve from the beginning of the interval to the last concentration above the limit of quantification plus the triangle from that last concentration to 0 at the first concentration below the limit of quantification", + desc="AUClast plus triangle, 0 at BLQ", pptestcd_cdisc="AUCALL", pptest_cdisc="AUC All") @@ -381,7 +381,7 @@ add.interval.col("aumcinf.obs", values=c(FALSE, TRUE), unit_type="aumc", pretty_name="AUMC,inf,obs", - desc="The area under the concentration time moment curve from the beginning of the interval to infinity with extrapolation to infinity from the observed Clast", + desc="AUMC start to inf, obs Clast extrap", depends=c("lambda.z", "clast.obs"), pptestcd_cdisc="AUMCIFO", pptest_cdisc="AUMC Infinity Obs") @@ -391,7 +391,7 @@ add.interval.col("aumcinf.pred", values=c(FALSE, TRUE), unit_type="aumc", pretty_name="AUMC,inf,pred", - desc="The area under the concentration time moment curve from the beginning of the interval to infinity with extrapolation to infinity from the predicted Clast", + desc="AUMC start to inf, pred Clast extrap", depends=c("lambda.z", "clast.pred"), pptestcd_cdisc="AUMCIFP", pptest_cdisc="AUMC Infinity Pred") @@ -401,7 +401,7 @@ add.interval.col("aumclast", values=c(FALSE, TRUE), unit_type="aumc", pretty_name="AUMC,last", - desc="The area under the concentration time moment curve from the beginning of the interval to the last concentration above the limit of quantification", + desc="AUMC start to last conc above LOQ", pptestcd_cdisc="AUMCLST", pptest_cdisc="AUMC to Last Nonzero Conc") @@ -410,7 +410,7 @@ add.interval.col("aumcall", values=c(FALSE, TRUE), unit_type="aumc", pretty_name="AUMC,all", - desc="The area under the concentration time moment curve from the beginning of the interval to the last concentration above the limit of quantification plus the moment of the triangle from that last concentration to 0 at the first concentration below the limit of quantification", + desc="AUMClast plus triangle moment, 0 at BLQ", pptestcd_cdisc="AUMCALL", pptest_cdisc="AUMC All") diff --git a/R/aucint.R b/R/aucint.R index f60cec3c..62164141 100644 --- a/R/aucint.R +++ b/R/aucint.R @@ -252,7 +252,7 @@ add.interval.col("aucint.last", values=c(FALSE, TRUE), unit_type="auc", pretty_name="AUCint (based on AUClast extrapolation)", - desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with zeros (matching AUClast)", + desc="AUC from T1 to T2 (zero extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL), pptestcd_cdisc="AUCINT", pptest_cdisc="AUC from T1 to T2") @@ -262,7 +262,7 @@ add.interval.col("aucint.last.dose", values=c(FALSE, TRUE), unit_type="auc", pretty_name="AUCint (based on AUClast extrapolation, dose-aware)", - desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with zeros (matching AUClast) with dose-aware interpolation/extrapolation of concentrations", + desc="AUCdn T1 to T2 (zero extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group"), pptestcd_cdisc="AUCINTD", pptest_cdisc="AUC from T1 to T2 Normalized by Dose") @@ -272,7 +272,7 @@ add.interval.col("aucint.all", values=c(FALSE, TRUE), unit_type="auc", pretty_name="AUCint (based on AUCall extrapolation)", - desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with the triangle from Tlast to the next point and zero thereafter (matching AUCall)", + desc="AUC from T1 to T2 (AUCall extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL), pptestcd_cdisc="AUCINTA", pptest_cdisc="AUCint (based on AUCall extrapolation)") @@ -282,7 +282,7 @@ add.interval.col("aucint.all.dose", values=c(FALSE, TRUE), unit_type="auc", pretty_name="AUCint (based on AUCall extrapolation, dose-aware)", - desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with the triangle from Tlast to the next point and zero thereafter (matching AUCall) with dose-aware interpolation/extrapolation of concentrations", + desc="AUCdn T1 to T2 (AUCall extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group"), pptestcd_cdisc="AUCINTAD", pptest_cdisc="AUCint (based on AUCall extrapolation, dose-aware)") @@ -292,7 +292,7 @@ add.interval.col("aucint.inf.obs", values=c(FALSE, TRUE), unit_type="auc", pretty_name="AUCint (based on AUCinf,obs extrapolation)", - desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with zeros (matching AUClast)", + desc="AUC from T1 to T2 (AUCinf,obs extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL), depends=c("lambda.z", "clast.obs"), pptestcd_cdisc="AUCINTIS", @@ -303,7 +303,7 @@ add.interval.col("aucint.inf.obs.dose", values=c(FALSE, TRUE), unit_type="auc", pretty_name="AUCint (based on AUCinf,obs extrapolation, dose-aware)", - desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with zeros (matching AUClast) with dose-aware interpolation/extrapolation of concentrations", + desc="AUCdn T1 to T2 (AUCinf,obs extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group"), depends=c("lambda.z", "clast.obs"), pptestcd_cdisc="AUCINTID", @@ -314,7 +314,7 @@ add.interval.col("aucint.inf.pred", values=c(FALSE, TRUE), unit_type="auc", pretty_name="AUCint (based on AUCinf,pred extrapolation)", - desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with the triangle from Tlast to the next point and zero thereafter (matching AUCall)", + desc="AUC from T1 to T2 (AUCinf,pred extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL), depends=c("lambda.z", "clast.pred"), pptestcd_cdisc="AUCINTIP", @@ -325,7 +325,7 @@ add.interval.col("aucint.inf.pred.dose", values=c(FALSE, TRUE), unit_type="auc", pretty_name="AUCint (based on AUCinf,pred extrapolation, dose-aware)", - desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with the triangle from Tlast to the next point and zero thereafter (matching AUCall) with dose-aware interpolation/extrapolation of concentrations", + desc="AUCdn T1 to T2 (AUCinf,pred extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group"), depends=c("lambda.z", "clast.pred"), pptestcd_cdisc="AUCINTPD", @@ -407,7 +407,7 @@ add.interval.col("aumcint.last", values=c(FALSE, TRUE), unit_type="aumc", pretty_name="AUMCint (based on AUMClast extrapolation)", - desc="The area under the moment curve in the interval extrapolating from Tlast to infinity with zeros (matching AUMClast)", + desc="AUMC from T1 to T2 (zero extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL)) # aumcint.last.dose (WITH dose awareness) @@ -416,7 +416,7 @@ add.interval.col("aumcint.last.dose", values=c(FALSE, TRUE), unit_type="aumc", pretty_name="AUMCint (based on AUMClast extrapolation, dose-aware)", - desc="The area under the moment curve in the interval extrapolating from Tlast to infinity with zeros (matching AUMClast) with dose-aware interpolation/extrapolation of concentrations", + desc="AUMCdn T1 to T2 (zero extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group")) # aumcint.all (without dose awareness) @@ -425,7 +425,7 @@ add.interval.col("aumcint.all", values=c(FALSE, TRUE), unit_type="aumc", pretty_name="AUMCint (based on AUMCall extrapolation)", - desc="The area under the moment curve in the interval extrapolating from Tlast to infinity with the triangle from Tlast to the next point and zero thereafter (matching AUMCall)", + desc="AUMC from T1 to T2 (AUMCall extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL)) # aumcint.all.dose (WITH dose awareness) @@ -434,7 +434,7 @@ add.interval.col("aumcint.all.dose", values=c(FALSE, TRUE), unit_type="aumc", pretty_name="AUMCint (based on AUMCall extrapolation, dose-aware)", - desc="The area under the moment curve in the interval extrapolating from Tlast to infinity with the triangle from Tlast to the next point and zero thereafter (matching AUMCall) with dose-aware interpolation/extrapolation of concentrations", + desc="AUMCdn T1 to T2 (AUMCall extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group")) # aumcint.inf.obs (without dose awareness) @@ -443,7 +443,7 @@ add.interval.col("aumcint.inf.obs", values=c(FALSE, TRUE), unit_type="aumc", pretty_name="AUMCint (based on AUMCinf,obs extrapolation)", - desc="The area under the moment curve in the interval extrapolating from Tlast to infinity with zeros (matching AUMClast)", + desc="AUMC from T1 to T2 (AUMCinf,obs extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL), depends=c("lambda.z", "clast.obs")) @@ -453,7 +453,7 @@ add.interval.col("aumcint.inf.obs.dose", values=c(FALSE, TRUE), unit_type="aumc", pretty_name="AUMCint (based on AUMCinf,obs extrapolation, dose-aware)", - desc="The area under the moment curve in the interval extrapolating from Tlast to infinity with zeros (matching AUMClast) with dose-aware interpolation/extrapolation of concentrations", + desc="AUMCdn T1 to T2 (AUMCinf,obs extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group"), depends=c("lambda.z", "clast.obs")) @@ -463,7 +463,7 @@ add.interval.col("aumcint.inf.pred", values=c(FALSE, TRUE), unit_type="aumc", pretty_name="AUMCint (based on AUMCinf,pred extrapolation)", - desc="The area under the moment curve in the interval extrapolating from Tlast to infinity with the triangle from Tlast to the next point and zero thereafter (matching AUMCall)", + desc="AUMC from T1 to T2 (AUMCinf,pred extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL), depends=c("lambda.z", "clast.pred")) @@ -473,7 +473,7 @@ add.interval.col("aumcint.inf.pred.dose", values=c(FALSE, TRUE), unit_type="aumc", pretty_name="AUMCint (based on AUMCinf,pred extrapolation, dose-aware)", - desc="The area under the moment curve in the interval extrapolating from Tlast to infinity with the triangle from Tlast to the next point and zero thereafter (matching AUMCall) with dose-aware interpolation/extrapolation of concentrations", + desc="AUMCdn T1 to T2 (AUMCinf,pred extrap)", formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group"), depends=c("lambda.z", "clast.pred")) diff --git a/R/auciv.R b/R/auciv.R index c8f6252d..93528ff1 100644 --- a/R/auciv.R +++ b/R/auciv.R @@ -75,7 +75,7 @@ add.interval.col( unit_type = "auc", pretty_name = "AUClast (IV dosing)", depends = c("auclast", "c0"), - desc = "The AUClast calculated with back-extrapolation for intravenous dosing using extrapolated C0", + desc = "AUClast, IV back-extrap C0", sparse = FALSE, formalsmap = list(auc="auclast"), pptestcd_cdisc="AUCIVLST", @@ -88,7 +88,7 @@ add.interval.col( unit_type = "auc", pretty_name = "AUCall (IV dosing)", depends = c("aucall", "c0"), - desc = "The AUCall calculated with back-extrapolation for intravenous dosing using extrapolated C0", + desc = "AUCall, IV back-extrap C0", sparse = FALSE, formalsmap = list(auc="aucall"), pptestcd_cdisc="AUCIVA", @@ -101,7 +101,7 @@ add.interval.col( unit_type = "auc", pretty_name = "AUCint,last (IV dosing)", depends = c("aucint.last", "c0"), - desc = "The AUCint,last calculated with back-extrapolation for intravenous dosing using extrapolated C0", + desc = "AUCint.last, IV back-extrap C0", sparse = FALSE, formalsmap = list(auc="aucint.last"), pptestcd_cdisc="AUCIVILT", @@ -114,7 +114,7 @@ add.interval.col( unit_type = "auc", pretty_name = "AUCint,all (IV dosing)", depends = c("aucint.all", "c0"), - desc = "The AUCint,all calculated with back-extrapolation for intravenous dosing using extrapolated C0", + desc = "AUCint.all, IV back-extrap C0", sparse = FALSE, formalsmap = list(auc="aucint.all"), pptestcd_cdisc="AUCIVINA", @@ -127,7 +127,7 @@ add.interval.col( unit_type = "auc", pretty_name = "AUCinf,obs (IV dosing)", depends = c("aucinf.obs", "c0"), - desc = "The AUCinf,obs calculated with back-extrapolation for intravenous dosing using extrapolated C0", + desc = "AUCinf.obs, IV back-extrap C0", sparse = FALSE, formalsmap = list(auc="aucinf.obs"), pptestcd_cdisc="AUCIVIS", @@ -140,7 +140,7 @@ add.interval.col( unit_type = "auc", pretty_name = "AUCinf,pred (IV dosing)", depends = c("aucinf.pred", "c0"), - desc = "The AUCinf,pred calculated with back-extrapolation for intravenous dosing using extrapolated C0", + desc = "AUCinf.pred, IV back-extrap C0", sparse = FALSE, formalsmap = list(auc="aucinf.pred"), pptestcd_cdisc="AUCIVIP", @@ -166,7 +166,7 @@ add.interval.col( unit_type = "%", pretty_name = "AUCbext (based on AUClast)", depends = c("auclast", "aucivlast"), - desc = "The back-extrapolation percent for intravenous dosing based on AUClast", + desc = "Back-extrap %, IV, AUClast", sparse = FALSE, formalsmap = list(auc="auclast", auciv="aucivlast"), pptestcd_cdisc="AUCIVPLT", @@ -179,7 +179,7 @@ add.interval.col( unit_type = "%", pretty_name = "AUCbext (based on AUCall)", depends = c("aucall", "aucivall"), - desc = "The back-extrapolation percent for intravenous dosing based on AUCall", + desc = "Back-extrap %, IV, AUCall", sparse = FALSE, formalsmap = list(auc="aucall", auciv="aucivall"), pptestcd_cdisc="AUCIVPEA", @@ -192,7 +192,7 @@ add.interval.col( unit_type = "%", pretty_name = "AUCbext (based on AUCint,last)", depends = c("aucint.last", "aucivint.last"), - desc = "The back-extrapolation percent for intravenous dosing based on AUCint,last", + desc = "Back-extrap %, IV, AUCint.last", sparse = FALSE, formalsmap = list(auc="aucint.last", auciv="aucivint.last"), pptestcd_cdisc="AUCIVPIL", @@ -205,7 +205,7 @@ add.interval.col( unit_type = "%", pretty_name = "AUCbext (based on AUCint,all)", depends = c("aucint.all", "aucivint.all"), - desc = "The back-extrapolation percent for intravenous dosing based on AUCint,all", + desc = "Back-extrap %, IV, AUCint.all", sparse = FALSE, formalsmap = list(auc="aucint.all", auciv="aucivint.all"), pptestcd_cdisc="AUCIVPIA", @@ -218,7 +218,7 @@ add.interval.col( unit_type = "%", pretty_name = "AUCbext (based on AUCinf,obs)", depends = c("aucinf.obs", "aucivinf.obs"), - desc = "The back-extrapolation percent for intravenous dosing based on AUCinf,obs", + desc = "Back-extrap %, IV, AUCinf.obs", sparse = FALSE, formalsmap = list(auc="aucinf.obs", auciv="aucivinf.obs"), pptestcd_cdisc="AUCIVPEI", @@ -231,7 +231,7 @@ add.interval.col( unit_type = "%", pretty_name = "AUCbext (based on AUCinf,pred)", depends = c("aucinf.pred", "aucivinf.pred"), - desc = "The back-extrapolation percent for intravenous dosing based on AUCinf,pred", + desc = "Back-extrap %, IV, AUCinf.pred", sparse = FALSE, formalsmap = list(auc="aucinf.pred", auciv="aucivinf.pred"), pptestcd_cdisc="AUCIVPEP", @@ -259,7 +259,7 @@ add.interval.col( unit_type = "aumc", pretty_name = "AUMClast (IV dosing)", depends = c("aumclast", "c0"), - desc = "The AUMClast calculated with back-extrapolation for intravenous dosing using extrapolated C0", + desc = "AUMClast, IV back-extrap C0", sparse = FALSE, formalsmap = list(aumc = "aumclast") ) @@ -270,7 +270,7 @@ add.interval.col( unit_type = "aumc", pretty_name = "AUMCall (IV dosing)", depends = c("aumcall", "c0"), - desc = "The AUMCall calculated with back-extrapolation for intravenous dosing using extrapolated C0", + desc = "AUMCall, IV back-extrap C0", sparse = FALSE, formalsmap = list(aumc = "aumcall") ) @@ -281,7 +281,7 @@ add.interval.col( unit_type = "aumc", pretty_name = "AUMCint,last (IV dosing)", depends = c("aumcint.last", "c0"), - desc = "The AUMCint,last calculated with back-extrapolation for intravenous dosing using extrapolated C0", + desc = "AUMCint.last, IV back-extrap C0", sparse = FALSE, formalsmap = list(aumc = "aumcint.last") ) @@ -292,7 +292,7 @@ add.interval.col( unit_type = "aumc", pretty_name = "AUMCint,all (IV dosing)", depends = c("aumcint.all", "c0"), - desc = "The AUMCint,all calculated with back-extrapolation for intravenous dosing using extrapolated C0", + desc = "AUMCint.all, IV back-extrap C0", sparse = FALSE, formalsmap = list(aumc = "aumcint.all") ) @@ -303,7 +303,7 @@ add.interval.col( unit_type = "aumc", pretty_name = "AUMCinf,obs (IV dosing)", depends = c("aumcinf.obs", "c0"), - desc = "The AUMCinf,obs calculated with back-extrapolation for intravenous dosing using extrapolated C0", + desc = "AUMCinf.obs, IV back-extrap C0", sparse = FALSE, formalsmap = list(aumc = "aumcinf.obs") ) @@ -314,7 +314,7 @@ add.interval.col( unit_type = "aumc", pretty_name = "AUMCinf,pred (IV dosing)", depends = c("aumcinf.pred", "c0"), - desc = "The AUMCinf,pred calculated with back-extrapolation for intravenous dosing using extrapolated C0", + desc = "AUMCinf.pred, IV back-extrap C0", sparse = FALSE, formalsmap = list(aumc = "aumcinf.pred") ) diff --git a/R/half.life.R b/R/half.life.R index d0532585..bae93bf8 100644 --- a/R/half.life.R +++ b/R/half.life.R @@ -637,7 +637,7 @@ add.interval.col("r.squared", values=c(FALSE, TRUE), unit_type="unitless", pretty_name="$r^2$", - desc="The r^2 value of the half-life calculation", + desc="R-squared of half-life fit", depends="half.life", pptestcd_cdisc="R2", pptest_cdisc="R Squared") @@ -652,7 +652,7 @@ add.interval.col("adj.r.squared", values=c(FALSE, TRUE), unit_type="unitless", pretty_name="$r^2_{adj}$", - desc="The adjusted r^2 value of the half-life calculation", + desc="Adjusted R-sq of half-life fit", depends="half.life", pptestcd_cdisc="R2ADJ", pptest_cdisc="R Squared Adjusted") @@ -667,7 +667,7 @@ add.interval.col("lambda.z.corrxy", values=c(FALSE, TRUE), unit_type="unitless", pretty_name="Correlation (time, log-conc)", - desc="Correlation between time and log-concentration for lambda.z points", + desc="Corr(time,log-conc) for lambda.z", depends="half.life", pptestcd_cdisc="CORRXY", pptest_cdisc="Correlation Between TimeX and Log ConcY") @@ -682,7 +682,7 @@ add.interval.col("lambda.z", values=c(FALSE, TRUE), unit_type="inverse_time", pretty_name="$\\lambda_z$", - desc="The elimination rate of the terminal half-life", + desc="Terminal elim rate (lambda.z)", depends="half.life", pptestcd_cdisc="LAMZ", pptest_cdisc="Lambda z") @@ -697,7 +697,7 @@ add.interval.col("lambda.z.time.first", values=c(FALSE, TRUE), unit_type="time", pretty_name="First time for $\\lambda_z$", - desc="The first time point used for the calculation of half-life", + desc="First time point for lambda.z", depends="half.life", pptestcd_cdisc="LAMZLL", pptest_cdisc="Lambda z Lower Limit") @@ -712,7 +712,7 @@ add.interval.col("lambda.z.time.last", values=c(FALSE, TRUE), unit_type="time", pretty_name="Last time for $\\lambda_z$", - desc="The last time point used for the calculation of half-life", + desc="Last time point for lambda.z", depends="half.life", pptestcd_cdisc="LAMZUL", pptest_cdisc="Lambda z Upper Limit") @@ -727,7 +727,7 @@ add.interval.col("lambda.z.n.points", values=c(FALSE, TRUE), unit_type="count", pretty_name="Number of points used for lambda_z", - desc="The number of points used for the calculation of half-life", + desc="Number of points used, lambda.z", depends="half.life", pptestcd_cdisc="LAMZNPT", pptest_cdisc="Number of Points for Lambda z") @@ -742,7 +742,7 @@ add.interval.col("clast.pred", values=c(FALSE, TRUE), unit_type="conc", pretty_name="Clast,pred", - desc="The concentration at Tlast as predicted by the half-life", + desc="Predicted Clast from half-life", depends="half.life", pptestcd_cdisc="CLSTP", pptest_cdisc="Clast pred") @@ -757,7 +757,7 @@ add.interval.col("span.ratio", values=c(FALSE, TRUE), unit_type="fraction", pretty_name="Span ratio", - desc="The ratio of the half-life to the duration used for half-life calculation", + desc="Half-life to calculation duration ratio", depends="half.life", pptestcd_cdisc="LAMZSPN", pptest_cdisc="Lambda z Span") @@ -772,7 +772,7 @@ add.interval.col("tobit_residual", values=c(FALSE, TRUE), unit_type="unitless", pretty_name="Tobit residual SD", - desc="The estimated residual standard deviation (on the log-concentration scale) from the Tobit half-life fit", + desc="Tobit fit residual SD, log-conc", depends="half.life") PKNCA.set.summary( name="tobit_residual", @@ -785,7 +785,7 @@ add.interval.col("adj_tobit_residual", values=c(FALSE, TRUE), unit_type="unitless", pretty_name="Adjusted Tobit residual SD", - desc="The adjusted Tobit residual standard deviation (analogous to adjusted r-squared; penalizes smaller windows)", + desc="Adjusted Tobit residual SD", depends="half.life") PKNCA.set.summary( name="adj_tobit_residual", @@ -798,7 +798,7 @@ add.interval.col("lambda.z.n.points_blq", values=c(FALSE, TRUE), unit_type="count", pretty_name="Number of BLQ points for lambda_z (Tobit)", - desc="The number of BLQ points included in the Tobit half-life calculation", + desc="BLQ points in Tobit lambda.z", depends="half.life") PKNCA.set.summary( name="lambda.z.n.points_blq", diff --git a/R/pk.calc.c0.R b/R/pk.calc.c0.R index 80006d0e..0e1f8dba 100644 --- a/R/pk.calc.c0.R +++ b/R/pk.calc.c0.R @@ -1,142 +1,142 @@ -#' Estimate the concentration at dosing time for an IV bolus dose. -#' -#' @inheritParams assert_conc_time -#' @inheritParams clean.conc.blq -#' @param time.dose The time when dosing occurred -#' @param method The order of methods to test (see details) -#' @returns The estimated concentration at time 0. -#' -#' @family NCA parameters for concentrations during the intervals -#' @details Methods available for interpolation are below, and each -#' has its own specific function. -#' -#' \describe{ -#' \item{`c0`}{If the observed `conc` at `time.dose` is nonzero, return that. This method should usually be used first for single-dose IV bolus data in case nominal time zero is measured.} -#' \item{`logslope`}{Compute the semilog line between the first two measured times, and use that line to extrapolate backward to `time.dose`} -#' \item{`c1`}{Use the first point after `time.dose`} -#' \item{`cmin`}{Set c0 to cmin during the interval. This method should usually be used for multiple-dose oral data and IV infusion data.} -#' \item{`set0`}{Set c0 to zero (regardless of any other data). This method should usually be used first for single-dose oral data.} -#' } -#' @export -pk.calc.c0 <- function(conc, time, time.dose=0, - method=c("c0", "logslope", "c1", "cmin", "set0"), - check=TRUE) { - # Check the inputs - if (check) { - assert_conc_time(conc = conc, time = time) - } +#' Estimate the concentration at dosing time for an IV bolus dose. +#' +#' @inheritParams assert_conc_time +#' @inheritParams clean.conc.blq +#' @param time.dose The time when dosing occurred +#' @param method The order of methods to test (see details) +#' @returns The estimated concentration at time 0. +#' +#' @family NCA parameters for concentrations during the intervals +#' @details Methods available for interpolation are below, and each +#' has its own specific function. +#' +#' \describe{ +#' \item{`c0`}{If the observed `conc` at `time.dose` is nonzero, return that. This method should usually be used first for single-dose IV bolus data in case nominal time zero is measured.} +#' \item{`logslope`}{Compute the semilog line between the first two measured times, and use that line to extrapolate backward to `time.dose`} +#' \item{`c1`}{Use the first point after `time.dose`} +#' \item{`cmin`}{Set c0 to cmin during the interval. This method should usually be used for multiple-dose oral data and IV infusion data.} +#' \item{`set0`}{Set c0 to zero (regardless of any other data). This method should usually be used first for single-dose oral data.} +#' } +#' @export +pk.calc.c0 <- function(conc, time, time.dose=0, + method=c("c0", "logslope", "c1", "cmin", "set0"), + check=TRUE) { + # Check the inputs + if (check) { + assert_conc_time(conc = conc, time = time) + } checkmate::assert_number(time.dose, na.ok = TRUE, finite = FALSE) - if (is.na(time.dose)) { + if (is.na(time.dose)) { rlang::warn("time.dose is NA", class = "pknca_warning_timedose_na") - return(structure(NA_real_, exclude = "dose time is missing")) - } else if (time.dose > max(time)) { + return(structure(NA_real_, exclude = "dose time is missing")) + } else if (time.dose > max(time)) { rlang::warn("time.dose is after all available data", class = "pknca_warning_timedose_after_data") - return(structure(NA_real_, exclude = "dose time is after all available concentration data")) - } - method <- match.arg(method, several.ok=TRUE) - # Find the value - ret <- NA + return(structure(NA_real_, exclude = "dose time is after all available concentration data")) + } + method <- match.arg(method, several.ok=TRUE) + # Find the value + ret <- NA while (is.na(ret) && - length(method) > 0) { - current.method <- method[1] - method <- method[-1] - ret <- do.call( - paste("pk.calc.c0.method", current.method, sep="."), - args=list( - conc=conc, - time=time, - time.dose=time.dose, - check=FALSE - ) - ) - } - ret -} - -#' @describeIn pk.calc.c0 Semilog regress the first and second points -#' after time.dose. This method will return `NA` if the second -#' `conc` after `time.dose` is 0 or greater than the first. -pk.calc.c0.method.logslope <- function(conc, time, time.dose=0, - check=TRUE) { - if (check) { - assert_conc_time(conc = conc, time = time) - } - mask.positive.time <- (time > time.dose & - !(is.na(conc))) - positive.time <- time[mask.positive.time] - if (length(positive.time) < 2) - return(NA) - # If there is enough data, proceed to calculate - mask.1 <- time %in% positive.time[1] - mask.2 <- time %in% positive.time[2] - c1 <- conc[mask.1] - c2 <- conc[mask.2] - t1 <- time[mask.1] - t2 <- time[mask.2] - if (c2 < c1 && - c2 != 0) { - exp(log(c1) - (log(c2)-log(c1))/(t2-t1)*(t1 - time.dose)) - } else { - NA - } -} - -#' @describeIn pk.calc.c0 Use `C0` = `conc[time %in% time.dose]` if it is -#' nonzero. -pk.calc.c0.method.c0 <- function(conc, time, time.dose=0, check=TRUE) { - if (check) { - assert_conc_time(conc = conc, time = time) - } - # If there is a non-missing and nonzero concentration measurement - # at time.dose, that's our answer. - mask.dose <- (time %in% time.dose & - !(conc %in% c(NA, 0))) - if (any(mask.dose)) { - conc[mask.dose] - } else { - NA - } -} - -#' @describeIn pk.calc.c0 Use `C0` = `C1`. -pk.calc.c0.method.c1 <- function(conc, time, time.dose=0, check=TRUE) { - if (check) { - assert_conc_time(conc = conc, time = time) - } - mask.post.dose <- (time > time.dose & - !is.na(conc)) - if (any(mask.post.dose)) { - conc[mask.post.dose][1] - } else { - NA - } -} - -#' @describeIn pk.calc.c0 Use `C0` = 0 (typically used for single dose oral and -#' IV infusion) -pk.calc.c0.method.set0 <- function(conc, time, time.dose=0, check=TRUE) { - 0 -} - -#' @describeIn pk.calc.c0 Use `C0` = Cmin (typically used for multiple dose oral -#' and IV infusion but not IV bolus) -pk.calc.c0.method.cmin <- function(conc, time, time.dose=0, check=TRUE) { - pk.calc.cmin(conc, check=check) -} - -# Add the column to the interval specification -add.interval.col("c0", - FUN="pk.calc.c0", - values=c(FALSE, TRUE), - unit_type="conc", - pretty_name="C0", - desc="Initial concentration after an IV bolus", + length(method) > 0) { + current.method <- method[1] + method <- method[-1] + ret <- do.call( + paste("pk.calc.c0.method", current.method, sep="."), + args=list( + conc=conc, + time=time, + time.dose=time.dose, + check=FALSE + ) + ) + } + ret +} + +#' @describeIn pk.calc.c0 Semilog regress the first and second points +#' after time.dose. This method will return `NA` if the second +#' `conc` after `time.dose` is 0 or greater than the first. +pk.calc.c0.method.logslope <- function(conc, time, time.dose=0, + check=TRUE) { + if (check) { + assert_conc_time(conc = conc, time = time) + } + mask.positive.time <- (time > time.dose & + !(is.na(conc))) + positive.time <- time[mask.positive.time] + if (length(positive.time) < 2) + return(NA) + # If there is enough data, proceed to calculate + mask.1 <- time %in% positive.time[1] + mask.2 <- time %in% positive.time[2] + c1 <- conc[mask.1] + c2 <- conc[mask.2] + t1 <- time[mask.1] + t2 <- time[mask.2] + if (c2 < c1 && + c2 != 0) { + exp(log(c1) - (log(c2)-log(c1))/(t2-t1)*(t1 - time.dose)) + } else { + NA + } +} + +#' @describeIn pk.calc.c0 Use `C0` = `conc[time %in% time.dose]` if it is +#' nonzero. +pk.calc.c0.method.c0 <- function(conc, time, time.dose=0, check=TRUE) { + if (check) { + assert_conc_time(conc = conc, time = time) + } + # If there is a non-missing and nonzero concentration measurement + # at time.dose, that's our answer. + mask.dose <- (time %in% time.dose & + !(conc %in% c(NA, 0))) + if (any(mask.dose)) { + conc[mask.dose] + } else { + NA + } +} + +#' @describeIn pk.calc.c0 Use `C0` = `C1`. +pk.calc.c0.method.c1 <- function(conc, time, time.dose=0, check=TRUE) { + if (check) { + assert_conc_time(conc = conc, time = time) + } + mask.post.dose <- (time > time.dose & + !is.na(conc)) + if (any(mask.post.dose)) { + conc[mask.post.dose][1] + } else { + NA + } +} + +#' @describeIn pk.calc.c0 Use `C0` = 0 (typically used for single dose oral and +#' IV infusion) +pk.calc.c0.method.set0 <- function(conc, time, time.dose=0, check=TRUE) { + 0 +} + +#' @describeIn pk.calc.c0 Use `C0` = Cmin (typically used for multiple dose oral +#' and IV infusion but not IV bolus) +pk.calc.c0.method.cmin <- function(conc, time, time.dose=0, check=TRUE) { + pk.calc.cmin(conc, check=check) +} + +# Add the column to the interval specification +add.interval.col("c0", + FUN="pk.calc.c0", + values=c(FALSE, TRUE), + unit_type="conc", + pretty_name="C0", + desc="Initial conc after IV bolus", depends=NULL, pptestcd_cdisc="C0", pptest_cdisc="Initial Conc") -PKNCA.set.summary( - name="c0", - description="geometric mean and geometric coefficient of variation", - point=business.geomean, - spread=business.geocv -) +PKNCA.set.summary( + name="c0", + description="geometric mean and geometric coefficient of variation", + point=business.geomean, + spread=business.geocv +) diff --git a/R/pk.calc.simple.R b/R/pk.calc.simple.R index 3813a315..77d38be5 100644 --- a/R/pk.calc.simple.R +++ b/R/pk.calc.simple.R @@ -123,7 +123,7 @@ add.interval.col("tmax", values=c(FALSE, TRUE), unit_type="time", pretty_name="Tmax", - desc="Time of the maximum observed concentration", + desc="Time of maximum observed conc", depends=NULL, pptestcd_cdisc="TMAX", pptest_cdisc="Time of CMAX") @@ -178,7 +178,7 @@ add.interval.col("tmin", values=c(FALSE, TRUE), unit_type="time", pretty_name="Tmin", - desc="Time of the minimum observed concentration", + desc="Time of minimum observed conc", depends=NULL, pptestcd_cdisc="TMIN", pptest_cdisc="Time of CMIN Observation") @@ -210,7 +210,7 @@ add.interval.col("tlast", values=c(FALSE, TRUE), unit_type="time", pretty_name="Tlast", - desc="Time of the last concentration observed above the limit of quantification", + desc="Time of last conc above LOQ", depends=NULL, pptestcd_cdisc="TLST", pptest_cdisc="Time of Last Nonzero Conc") @@ -234,7 +234,7 @@ add.interval.col("tfirst", values=c(FALSE, TRUE), unit_type="time", pretty_name="Tfirst", - desc="Time of the first concentration above the limit of quantification", + desc="Time of first conc above LOQ", depends=NULL, pptestcd_cdisc="TFIRST", pptest_cdisc="Time of First Nonzero Conc") @@ -275,7 +275,7 @@ add.interval.col("clast.obs", values=c(FALSE, TRUE), unit_type="conc", pretty_name="Clast", - desc="The last concentration observed above the limit of quantification", + desc="Last conc observed above LOQ", depends=NULL, pptestcd_cdisc="CLST", pptest_cdisc="Last Nonzero Conc") @@ -295,7 +295,7 @@ pk.calc.thalf.eff <- function(mrt) { add.interval.col("thalf.eff.obs", FUN="pk.calc.thalf.eff", values=c(FALSE, TRUE), - desc="The effective half-life (as determined from the MRTobs)", + desc="Effective half-life, MRTobs", unit_type="time", pretty_name="Effective half-life (based on MRT,obs)", formalsmap=list(mrt="mrt.obs"), @@ -308,7 +308,7 @@ add.interval.col("thalf.eff.pred", values=c(FALSE, TRUE), unit_type="time", pretty_name="Effective half-life (based on MRT,pred)", - desc="The effective half-life (as determined from the MRTpred)", + desc="Effective half-life, MRTpred", formalsmap=list(mrt="mrt.pred"), depends="mrt.pred", pptestcd_cdisc="EFFPHL", @@ -319,7 +319,7 @@ add.interval.col("thalf.eff.last", values=c(FALSE, TRUE), unit_type="time", pretty_name="Effective half-life (based on MRT,last)", - desc="The effective half-life (as determined from the MRTlast)", + desc="Effective half-life, MRTlast", formalsmap=list(mrt="mrt.last"), depends="mrt.last", pptestcd_cdisc="EFFHL", @@ -330,7 +330,7 @@ add.interval.col("thalf.eff.iv.obs", values=c(FALSE, TRUE), unit_type="time", pretty_name="Effective half-life (for IV dosing, based on MRT,obs)", - desc="The effective half-life (as determined from the intravenous MRTobs)", + desc="Effective half-life, IV MRTobs", formalsmap=list(mrt="mrt.iv.obs"), depends="mrt.iv.obs", pptestcd_cdisc="EFFIVOHL", @@ -341,7 +341,7 @@ add.interval.col("thalf.eff.iv.pred", values=c(FALSE, TRUE), unit_type="time", pretty_name="Effective half-life (for IV dosing, based on MRT,pred)", - desc="The effective half-life (as determined from the intravenous MRTpred)", + desc="Effective half-life, IV MRTpred", formalsmap=list(mrt="mrt.iv.pred"), depends="mrt.iv.pred", pptestcd_cdisc="EFFIVPHL", @@ -352,7 +352,7 @@ add.interval.col("thalf.eff.iv.last", values=c(FALSE, TRUE), unit_type="time", pretty_name="Effective half-life (for IV dosing, based on MRTlast)", - desc="The effective half-life (as determined from the intravenous MRTlast)", + desc="Effective half-life, IV MRTlast", formalsmap=list(mrt="mrt.iv.last"), depends="mrt.iv.last", pptestcd_cdisc="EFFIVLHL", @@ -416,7 +416,7 @@ add.interval.col("aucpext.obs", values=c(FALSE, TRUE), unit_type="%", pretty_name="AUCpext (based on AUCinf,obs)", - desc="Percent of the AUCinf that is extrapolated after Tlast calculated from the observed Clast", + desc="% AUCinf extrap after Tlast, obs", formalsmap=list(aucinf="aucinf.obs"), depends=c("auclast", "aucinf.obs"), pptestcd_cdisc="AUCPEO", @@ -427,7 +427,7 @@ add.interval.col("aucpext.pred", values=c(FALSE, TRUE), unit_type="%", pretty_name="AUCpext (based on AUCinf,pred)", - desc="Percent of the AUCinf that is extrapolated after Tlast calculated from the predicted Clast", + desc="% AUCinf extrap after Tlast, pred", formalsmap=list(aucinf="aucinf.pred"), depends=c("auclast", "aucinf.pred"), pptestcd_cdisc="AUCPEP", @@ -451,7 +451,7 @@ add.interval.col("kel.obs", values=c(FALSE, TRUE), unit_type="inverse_time", pretty_name="Kel (based on AUCinf,obs)", - desc="Elimination rate (as calculated from the MRT with observed Clast)", + desc="Elim rate, MRT w/ obs Clast", formalsmap=list(mrt="mrt.obs"), depends="mrt.obs", pptestcd_cdisc="KELOS", @@ -462,7 +462,7 @@ add.interval.col("kel.pred", values=c(FALSE, TRUE), unit_type="inverse_time", pretty_name="Kel (based on AUCinf,pred)", - desc="Elimination rate (as calculated from the MRT with predicted Clast)", + desc="Elim rate, MRT w/ pred Clast", formalsmap=list(mrt="mrt.pred"), depends="mrt.pred", pptestcd_cdisc="KELP", @@ -473,7 +473,7 @@ add.interval.col("kel.last", values=c(FALSE, TRUE), unit_type="inverse_time", pretty_name="Kel (based on AUClast)", - desc="Elimination rate (as calculated from the MRT using AUClast)", + desc="Elim rate, MRT via AUClast", formalsmap=list(mrt="mrt.last"), depends="mrt.last", pptestcd_cdisc="KELLST", @@ -484,7 +484,7 @@ add.interval.col("kel.iv.obs", values=c(FALSE, TRUE), unit_type="inverse_time", pretty_name="Kel (for IV dosing, based on AUCinf,obs)", - desc="Elimination rate (as calculated from the intravenous MRTobs)", + desc="Elim rate, IV MRTobs", formalsmap=list(mrt="mrt.iv.obs"), depends="mrt.iv.obs", pptestcd_cdisc="KELIVOS", @@ -495,7 +495,7 @@ add.interval.col("kel.iv.pred", values=c(FALSE, TRUE), unit_type="inverse_time", pretty_name="Kel (for IV dosing, based on AUCinf,pred)", - desc="Elimination rate (as calculated from the intravenous MRTpred)", + desc="Elim rate, IV MRTpred", formalsmap=list(mrt="mrt.iv.pred"), depends="mrt.iv.pred", pptestcd_cdisc="KELIVP", @@ -506,7 +506,7 @@ add.interval.col("kel.iv.last", values=c(FALSE, TRUE), unit_type="inverse_time", pretty_name="Kel (for IV dosing, based on AUClast)", - desc="Elimination rate (as calculated from the intravenous MRTlast)", + desc="Elim rate, IV MRTlast", formalsmap=list(mrt="mrt.iv.last"), depends="mrt.iv.last", pptestcd_cdisc="KELIVLT", @@ -517,7 +517,7 @@ add.interval.col("kel.all", values = c(FALSE, TRUE), unit_type = "inverse_time", pretty_name = "Kel (based on AUCall)", - desc = "Elimination rate (as calculated from the MRTall)", + desc = "Elim rate, MRTall", formalsmap = list(mrt = "mrt.all"), depends = "mrt.all") @@ -526,7 +526,7 @@ add.interval.col("kel.int.all", values = c(FALSE, TRUE), unit_type = "inverse_time", pretty_name = "Kel (based on AUCint.all)", - desc = "Elimination rate (as calculated from the MRTint.all)", + desc = "Elim rate, MRTint.all", formalsmap = list(mrt = "mrt.int.all"), depends = "mrt.int.all") @@ -535,7 +535,7 @@ add.interval.col("kel.int.inf.obs", values = c(FALSE, TRUE), unit_type = "inverse_time", pretty_name = "Kel (based on AUCint.inf.obs)", - desc = "Elimination rate (as calculated from the MRTint.inf.obs)", + desc = "Elim rate, MRTint.inf.obs", formalsmap = list(mrt = "mrt.int.inf.obs"), depends = "mrt.int.inf.obs") @@ -544,7 +544,7 @@ add.interval.col("kel.int.inf.pred", values = c(FALSE, TRUE), unit_type = "inverse_time", pretty_name = "Kel (based on AUCint.inf.pred)", - desc = "Elimination rate (as calculated from the MRTint.inf.pred)", + desc = "Elim rate, MRTint.inf.pred", formalsmap = list(mrt = "mrt.int.inf.pred"), depends = "mrt.int.inf.pred") @@ -553,7 +553,7 @@ add.interval.col("kel.int.last", values = c(FALSE, TRUE), unit_type = "inverse_time", pretty_name = "Kel (based on AUCint.last)", - desc = "Elimination rate (as calculated from the MRTint.last)", + desc = "Elim rate, MRTint.last", formalsmap = list(mrt = "mrt.int.last"), depends = "mrt.int.last") @@ -562,7 +562,7 @@ add.interval.col("kel.iv.all", values = c(FALSE, TRUE), unit_type = "inverse_time", pretty_name = "Kel (for IV dosing, based on AUCall)", - desc = "Elimination rate (as calculated from the MRTiv.all))", + desc = "Elim rate, IV MRTall", formalsmap = list(mrt = "mrt.iv.all"), depends = "mrt.iv.all") @@ -571,7 +571,7 @@ add.interval.col("kel.ivint.all", values = c(FALSE, TRUE), unit_type = "inverse_time", pretty_name = "Kel (IV dose interval, based on AUCint.all)", - desc = "Elimination rate (as calculated from the MRTivint.all)", + desc = "Elim rate, IV MRTint.all", formalsmap = list(mrt = "mrt.ivint.all"), depends = "mrt.ivint.all") @@ -580,7 +580,7 @@ add.interval.col("kel.ivint.last", values = c(FALSE, TRUE), unit_type = "inverse_time", pretty_name = "Kel (IV dose interval, based on AUCint.last)", - desc = "Elimination rate (as calculated from the MRTivint.last)", + desc = "Elim rate, IV MRTint.last", formalsmap = list(mrt = "mrt.ivint.last"), depends = "mrt.ivint.last") @@ -589,11 +589,12 @@ add.interval.col("kel.sparse.last", values = c(FALSE, TRUE), unit_type = "inverse_time", pretty_name = "Kel (for sparse data, based on AUClast)", - desc = "Elimination rate (as calculated from the MRTsparse.last)", + desc = "Elim rate, sparse MRTlast", sparse = TRUE, formalsmap = list(mrt = "mrt.sparse.last"), depends = "mrt.sparse.last") + #' Calculate the (observed oral) clearance #' #' @details cl is `dose/auc`. @@ -631,7 +632,7 @@ add.interval.col("cl.last", values=c(FALSE, TRUE), unit_type="clearance", pretty_name="CL (based on AUClast)", - desc="Clearance or observed oral clearance calculated to Clast", + desc="Clearance, AUClast", formalsmap=list(auc="auclast"), depends="auclast", pptestcd_cdisc=list(route=list(extravascular="CLF/FLST", intravascular="CLLST")), @@ -642,7 +643,7 @@ add.interval.col("cl.all", values=c(FALSE, TRUE), unit_type="clearance", pretty_name="CL (based on AUCall)", - desc="Clearance or observed oral clearance calculated with AUCall", + desc="Clearance, AUCall", formalsmap=list(auc="aucall"), depends="aucall", pptestcd_cdisc=list(route=list(extravascular="CLF/FALL", intravascular="CLALL")), @@ -653,7 +654,7 @@ add.interval.col("cl.obs", values=c(FALSE, TRUE), unit_type="clearance", pretty_name="CL (based on AUCinf,obs)", - desc="Clearance or observed oral clearance calculated with observed Clast", + desc="Clearance, observed Clast", formalsmap=list(auc="aucinf.obs"), depends="aucinf.obs", pptestcd_cdisc=list(route=list(extravascular="CLF/FO", intravascular="CLO")), @@ -664,7 +665,7 @@ add.interval.col("cl.pred", values=c(FALSE, TRUE), unit_type="clearance", pretty_name="CL (based on AUCinf,pred)", - desc="Clearance or observed oral clearance calculated with predicted Clast", + desc="Clearance, predicted Clast", formalsmap=list(auc="aucinf.pred"), depends="aucinf.pred", pptestcd_cdisc=list(route=list(extravascular="CLF/FP", intravascular="CLP")), @@ -675,7 +676,7 @@ add.interval.col("cl.int.all", values = c(FALSE, TRUE), unit_type = "clearance", pretty_name = "CL (based on AUCint.all)", - desc = "Clearance or observed oral clearance calculated with AUCint.all", + desc = "Clearance, AUCint.all", formalsmap = list(auc = "aucint.all"), depends = "aucint.all") @@ -684,7 +685,7 @@ add.interval.col("cl.int.inf.obs", values = c(FALSE, TRUE), unit_type = "clearance", pretty_name = "CL (based on AUCint.inf.obs)", - desc = "Clearance or observed oral clearance calculated with AUCint.inf.obs", + desc = "Clearance, AUCint.inf.obs", formalsmap = list(auc = "aucint.inf.obs"), depends = "aucint.inf.obs") @@ -693,7 +694,7 @@ add.interval.col("cl.int.inf.pred", values = c(FALSE, TRUE), unit_type = "clearance", pretty_name = "CL (based on AUCint.inf.pred)", - desc = "Clearance or observed oral clearance calculated with AUCint.inf.pred", + desc = "Clearance, AUCint.inf.pred", formalsmap = list(auc = "aucint.inf.pred"), depends = "aucint.inf.pred") @@ -702,7 +703,7 @@ add.interval.col("cl.int.last", values = c(FALSE, TRUE), unit_type = "clearance", pretty_name = "CL (based on AUCint.last)", - desc = "Clearance or observed oral clearance calculated with AUCint.last", + desc = "Clearance, AUCint.last", formalsmap = list(auc = "aucint.last"), depends = "aucint.last") @@ -711,7 +712,7 @@ add.interval.col("cl.iv.all", values = c(FALSE, TRUE), unit_type = "clearance", pretty_name = "CL (for IV dosing, based on AUCall)", - desc = "Clearance for intravenous dosing calculated with AUCall", + desc = "IV clearance, AUCall", formalsmap = list(auc = "aucivall"), depends = "aucivall") @@ -720,7 +721,7 @@ add.interval.col("cl.iv.last", values = c(FALSE, TRUE), unit_type = "clearance", pretty_name = "CL (for IV dosing, based on AUClast)", - desc = "Clearance for intravenous dosing calculated with AUClast", + desc = "IV clearance, AUClast", formalsmap = list(auc = "aucivlast"), depends = "aucivlast") @@ -729,7 +730,7 @@ add.interval.col("cl.iv.obs", values = c(FALSE, TRUE), unit_type = "clearance", pretty_name = "CL (for IV dosing, based on AUCinf,obs)", - desc = "Clearance for intravenous dosing calculated with AUCinf,obs", + desc = "IV clearance, AUCinf.obs", formalsmap = list(auc = "aucivinf.obs"), depends = "aucivinf.obs") @@ -738,7 +739,7 @@ add.interval.col("cl.iv.pred", values = c(FALSE, TRUE), unit_type = "clearance", pretty_name = "CL (for IV dosing, based on AUCinf,pred)", - desc = "Clearance for intravenous dosing calculated with AUCinf,pred", + desc = "IV clearance, AUCinf.pred", formalsmap = list(auc = "aucivinf.pred"), depends = "aucivinf.pred") @@ -747,7 +748,7 @@ add.interval.col("cl.ivint.all", values = c(FALSE, TRUE), unit_type = "clearance", pretty_name = "CL (IV dose interval, based on AUCint.all)", - desc = "Clearance for intravenous dosing calculated with interval AUCint.all", + desc = "IV clearance, AUCint.all", formalsmap = list(auc = "aucivint.all"), depends = "aucivint.all") @@ -756,7 +757,7 @@ add.interval.col("cl.ivint.last", values = c(FALSE, TRUE), unit_type = "clearance", pretty_name = "CL (IV dose interval, based on AUCint.last)", - desc = "Clearance for intravenous dosing calculated with interval AUCint.last", + desc = "IV clearance, AUCint.last", formalsmap = list(auc = "aucivint.last"), depends = "aucivint.last") @@ -765,7 +766,7 @@ add.interval.col("cl.sparse.last", values = c(FALSE, TRUE), unit_type = "clearance", pretty_name = "CL (for sparse data, based on AUClast)", - desc = "Clearance from sparse sampling calculated with population AUClast", + desc = "Clearance, sparse AUClast", sparse = TRUE, formalsmap = list(auc = "sparse_auclast"), depends = "sparse_auclast") @@ -798,7 +799,7 @@ add.interval.col("f", values=c(FALSE, TRUE), unit_type="fraction", pretty_name="Bioavailability", - desc="Bioavailability or relative bioavailability", + desc="Bioavailability (absolute or relative)", depends=NULL, pptestcd_cdisc="FAB", pptest_cdisc="Absolute Bioavailability") @@ -826,7 +827,7 @@ add.interval.col("mrt.obs", values=c(FALSE, TRUE), unit_type="time", pretty_name="MRT (based on AUCinf,obs)", - desc="The mean residence time to infinity using observed Clast", + desc="MRT to inf, observed Clast", formalsmap=list(auc="aucinf.obs", aumc="aumcinf.obs"), depends=c("aucinf.obs", "aumcinf.obs"), pptestcd_cdisc=list(route=list(extravascular="MRTEVFO", intravascular="MRTICFO")), @@ -837,7 +838,7 @@ add.interval.col("mrt.pred", values=c(FALSE, TRUE), unit_type="time", pretty_name="MRT (based on AUCinf,pred)", - desc="The mean residence time to infinity using predicted Clast", + desc="MRT to inf, predicted Clast", formalsmap=list(auc="aucinf.pred", aumc="aumcinf.pred"), depends=c("aucinf.pred", "aumcinf.pred"), pptestcd_cdisc=list(route=list(extravascular="MRTEVFP", intravascular="MRTICFP")), @@ -848,7 +849,7 @@ add.interval.col("mrt.last", values=c(FALSE, TRUE), unit_type="time", pretty_name="MRT (based on AUClast)", - desc="The mean residence time to the last observed concentration above the LOQ", + desc="MRT, AUClast/AUMClast", formalsmap=list(auc="auclast", aumc="aumclast"), depends=c("auclast", "aumclast"), pptestcd_cdisc=list(route=list(extravascular="MRTEVLST", intravascular="MRTICLST")), @@ -859,7 +860,7 @@ add.interval.col("mrt.all", values = c(FALSE, TRUE), unit_type = "time", pretty_name = "MRT (based on AUCall)", - desc = "Mean residence time calculated with AUCall/AUMCall", + desc = "MRT, AUCall/AUMCall", formalsmap = list(auc = "aucall", aumc = "aumcall"), depends = c("aucall", "aumcall")) @@ -868,7 +869,7 @@ add.interval.col("mrt.int.all", values = c(FALSE, TRUE), unit_type = "time", pretty_name = "MRT (based on AUCint.all)", - desc = "Mean residence time over interval calculated with AUCint.all/AUMCint.all", + desc = "MRT, interval AUCall/AUMCall", formalsmap = list(auc = "aucint.all", aumc = "aumcint.all"), depends = c("aucint.all", "aumcint.all")) @@ -877,7 +878,7 @@ add.interval.col("mrt.int.inf.obs", values = c(FALSE, TRUE), unit_type = "time", pretty_name = "MRT (based on AUCint.inf.obs)", - desc = "Mean residence time over interval calculated with AUCint.inf.obs/AUMCint.inf.obs", + desc = "MRT, interval AUC/AUMCinf obs", formalsmap = list(auc = "aucint.inf.obs", aumc = "aumcint.inf.obs"), depends = c("aucint.inf.obs", "aumcint.inf.obs")) @@ -886,7 +887,7 @@ add.interval.col("mrt.int.inf.pred", values = c(FALSE, TRUE), unit_type = "time", pretty_name = "MRT (based on AUCint.inf.pred)", - desc = "Mean residence time over interval calculated with AUCint.inf.pred/AUMCint.inf.pred", + desc = "MRT, interval AUC/AUMCinf pred", formalsmap = list(auc = "aucint.inf.pred", aumc = "aumcint.inf.pred"), depends = c("aucint.inf.pred", "aumcint.inf.pred")) @@ -895,7 +896,7 @@ add.interval.col("mrt.int.last", values = c(FALSE, TRUE), unit_type = "time", pretty_name = "MRT (based on AUCint.last)", - desc = "Mean residence time over interval calculated with AUCint.last/AUMCint.last", + desc = "MRT, interval AUClast/AUMClast", formalsmap = list(auc = "aucint.last", aumc = "aumcint.last"), depends = c("aucint.last", "aumcint.last")) @@ -904,7 +905,7 @@ add.interval.col("mrt.sparse.last", values = c(FALSE, TRUE), unit_type = "time", pretty_name = "MRT (for sparse data, based on AUClast)", - desc = "Mean residence time from sparse sampling", + desc = "MRT, sparse AUClast/AUMClast", sparse = TRUE, formalsmap = list(auc = "sparse_auclast", aumc = "sparse_aumclast"), depends = c("sparse_auclast", "sparse_aumclast")) @@ -927,7 +928,7 @@ add.interval.col("mrt.iv.obs", values=c(FALSE, TRUE), unit_type="time", pretty_name="MRT (for IV dosing, based on AUCinf,obs)", - desc="The mean residence time to infinity using observed Clast correcting for dosing duration", + desc="IV MRT, AUCinf.obs/AUMCinf.obs", formalsmap=list(auc="aucinf.obs", aumc="aumcinf.obs"), depends=c("aucinf.obs", "aumcinf.obs"), pptestcd_cdisc="MRTIBIFO", @@ -938,7 +939,7 @@ add.interval.col("mrt.iv.pred", values=c(FALSE, TRUE), unit_type="time", pretty_name="MRT (for IV dosing, based on AUCinf,pred)", - desc="The mean residence time to infinity using predicted Clast correcting for dosing duration", + desc="IV MRT, AUCinf.pred/AUMCinf.pred", formalsmap=list(auc="aucinf.pred", aumc="aumcinf.pred"), depends=c("aucinf.pred", "aumcinf.pred"), pptestcd_cdisc="MRTIBIFP", @@ -949,7 +950,7 @@ add.interval.col("mrt.iv.last", values=c(FALSE, TRUE), unit_type="time", pretty_name="MRT (for IV dosing, based on AUClast)", - desc="The mean residence time to the last observed concentration above the LOQ correcting for dosing duration", + desc="IV MRT, AUClast/AUMClast", formalsmap=list(auc="auclast", aumc="aumclast"), depends=c("auclast", "aumclast"), pptestcd_cdisc="MRTIBLST", @@ -960,7 +961,7 @@ add.interval.col("mrt.iv.all", values = c(FALSE, TRUE), unit_type = "time", pretty_name = "MRT (for IV dosing, based on AUCall)", - desc = "Mean residence time for IV dosing calculated with AUCall/AUMCall", + desc = "IV MRT, AUCall/AUMCall", formalsmap = list(auc = "aucivall", aumc = "aumcivall"), depends = c("aucivall", "aumcivall")) @@ -969,7 +970,7 @@ add.interval.col("mrt.ivint.all", values = c(FALSE, TRUE), unit_type = "time", pretty_name = "MRT (IV dose interval, based on AUCint.all)", - desc = "Mean residence time for IV interval calculated with AUCint.all/AUMCint.all", + desc = "IV MRT, interval AUC/AUMCall", formalsmap = list(auc = "aucivint.all", aumc = "aumcivint.all"), depends = c("aucivint.all", "aumcivint.all")) @@ -978,7 +979,7 @@ add.interval.col("mrt.ivint.last", values = c(FALSE, TRUE), unit_type = "time", pretty_name = "MRT (IV dose interval, based on AUCint.last)", - desc = "Mean residence time for IV interval calculated with AUCint.last/AUMCint.last", + desc = "IV MRT, interval AUC/AUMClast", formalsmap = list(auc = "aucivint.last", aumc = "aumcivint.last"), depends = c("aucivint.last", "aumcivint.last")) @@ -1010,7 +1011,7 @@ add.interval.col("mrt.md.obs", values=c(FALSE, TRUE), unit_type="time", pretty_name="MRT (for multiple dosing, based on AUCinf,obs)", - desc="The mean residence time with multiple dosing and nonlinear kinetics using observed Clast", + desc="MRT, multi-dose AUCinf.obs/AUMCinf.obs", formalsmap=list(auctau="auclast", aumctau="aumclast", aucinf="aucinf.obs"), depends=c("auclast", "aumclast", "aucinf.obs"), pptestcd_cdisc="MRTMDO", @@ -1021,7 +1022,7 @@ add.interval.col("mrt.md.pred", values=c(FALSE, TRUE), unit_type="time", pretty_name="MRT (for multiple dosing, based on AUCinf,pred)", - desc="The mean residence time with multiple dosing and nonlinear kinetics using predicted Clast", + desc="MRT, multi-dose AUCinf.pred/AUMCinf.pred", formalsmap=list(auctau="auclast", aumctau="aumclast", aucinf="aucinf.pred"), depends=c("auclast", "aumclast", "aucinf.pred"), pptestcd_cdisc="MRTMDP", @@ -1053,7 +1054,7 @@ add.interval.col("vz.obs", values=c(FALSE, TRUE), unit_type="volume", pretty_name="Vz (based on AUCinf,obs)", - desc="The terminal volume of distribution using observed Clast", + desc="Vz, observed Clast", formalsmap=list(cl="cl.obs"), depends=c("cl.obs", "lambda.z"), pptestcd_cdisc=list(route=list(extravascular="VZF/FO", intravascular="VZO")), @@ -1064,7 +1065,7 @@ add.interval.col("vz.pred", values=c(FALSE, TRUE), unit_type="volume", pretty_name="Vz (based on AUCinf,pred)", - desc="The terminal volume of distribution using predicted Clast", + desc="Vz, predicted Clast", formalsmap=list(cl="cl.pred"), depends=c("cl.pred", "lambda.z"), pptestcd_cdisc=list(route=list(extravascular="VZF/FP", intravascular="VZP")), @@ -1075,7 +1076,7 @@ add.interval.col("vz.all", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vz (based on AUCall)", - desc = "Terminal volume of distribution calculated with AUCall-based CL", + desc = "Vz, AUCall-based CL", formalsmap = list(cl = "cl.all"), depends = c("cl.all", "lambda.z")) @@ -1084,7 +1085,7 @@ add.interval.col("vz.int.all", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vz (based on AUCint.all)", - desc = "Terminal volume of distribution using interval AUCint.all", + desc = "Vz, interval AUCint.all", formalsmap = list(cl = "cl.int.all"), depends = c("cl.int.all", "lambda.z")) @@ -1093,7 +1094,7 @@ add.interval.col("vz.int.inf.obs", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vz (based on AUCint.inf.obs)", - desc = "Terminal volume of distribution using interval AUCint.inf.obs", + desc = "Vz, interval AUCint.inf.obs", formalsmap = list(cl = "cl.int.inf.obs"), depends = c("cl.int.inf.obs", "lambda.z")) @@ -1102,7 +1103,7 @@ add.interval.col("vz.int.inf.pred", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vz (based on AUCint.inf.pred)", - desc = "Terminal volume of distribution using interval AUCint.inf.pred", + desc = "Vz, interval AUCint.inf.pred", formalsmap = list(cl = "cl.int.inf.pred"), depends = c("cl.int.inf.pred", "lambda.z")) @@ -1111,7 +1112,7 @@ add.interval.col("vz.int.last", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vz (based on AUCint.last)", - desc = "Terminal volume of distribution using interval AUCint.last", + desc = "Vz, interval AUCint.last", formalsmap = list(cl = "cl.int.last"), depends = c("cl.int.last", "lambda.z")) @@ -1120,7 +1121,7 @@ add.interval.col("vz.iv.all", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vz (for IV dosing, based on AUCall)", - desc = "Terminal volume of distribution for IV dosing using AUCall", + desc = "IV Vz, AUCall", formalsmap = list(cl = "cl.iv.all"), depends = c("cl.iv.all", "lambda.z")) @@ -1129,7 +1130,7 @@ add.interval.col("vz.iv.last", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vz (for IV dosing, based on AUClast)", - desc = "Terminal volume of distribution for IV dosing using AUClast", + desc = "IV Vz, AUClast", formalsmap = list(cl = "cl.iv.last"), depends = c("cl.iv.last", "lambda.z")) @@ -1138,7 +1139,7 @@ add.interval.col("vz.iv.obs", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vz (for IV dosing, based on AUCinf,obs)", - desc = "Terminal volume of distribution for IV dosing using observed AUCinf", + desc = "IV Vz, observed AUCinf", formalsmap = list(cl = "cl.iv.obs"), depends = c("cl.iv.obs", "lambda.z")) @@ -1147,7 +1148,7 @@ add.interval.col("vz.iv.pred", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vz (for IV dosing, based on AUCinf,pred)", - desc = "Terminal volume of distribution for IV dosing using predicted AUCinf", + desc = "IV Vz, predicted AUCinf", formalsmap = list(cl = "cl.iv.pred"), depends = c("cl.iv.pred", "lambda.z")) @@ -1156,7 +1157,7 @@ add.interval.col("vz.ivint.all", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vz (IV dose interval, based on AUCint.all)", - desc = "Terminal volume of distribution for IV interval using AUCint.all", + desc = "IV Vz, interval AUCint.all", formalsmap = list(cl = "cl.ivint.all"), depends = c("cl.ivint.all", "lambda.z")) @@ -1165,7 +1166,7 @@ add.interval.col("vz.ivint.last", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vz (IV dose interval, based on AUCint.last)", - desc = "Terminal volume of distribution for IV interval using AUCint.last", + desc = "IV Vz, interval AUCint.last", formalsmap = list(cl = "cl.ivint.last"), depends = c("cl.ivint.last", "lambda.z")) @@ -1174,7 +1175,7 @@ add.interval.col("vz.last", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vz (based on AUClast)", - desc = "Terminal volume of distribution calculated with AUClast-based CL", + desc = "Vz, AUClast-based CL", formalsmap = list(cl = "cl.last"), depends = c("cl.last", "lambda.z")) @@ -1183,7 +1184,7 @@ add.interval.col("vz.sparse.last", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vz (for sparse data, based on AUClast)", - desc = "Terminal volume of distribution from sparse sampling", + desc = "Vz from sparse sampling", sparse = TRUE, formalsmap = list(cl = "cl.sparse.last", lambda.z = "kel.sparse.last"), depends = c("cl.sparse.last", "kel.sparse.last")) @@ -1204,7 +1205,7 @@ add.interval.col("vss.obs", values=c(FALSE, TRUE), unit_type="volume", pretty_name="Vss (based on AUCinf,obs)", - desc="The steady-state volume of distribution using observed Clast", + desc="Vss, observed Clast", formalsmap=list(cl="cl.obs", mrt="mrt.obs"), depends=c("cl.obs", "mrt.obs"), pptestcd_cdisc=list(route=list(extravascular="VSSF/FO", intravascular="VSSO")), @@ -1215,7 +1216,7 @@ add.interval.col("vss.pred", values=c(FALSE, TRUE), unit_type="volume", pretty_name="Vss (based on AUCinf,pred)", - desc="The steady-state volume of distribution using predicted Clast", + desc="Vss, predicted Clast", formalsmap=list(cl="cl.pred", mrt="mrt.pred"), depends=c("cl.pred", "mrt.pred"), pptestcd_cdisc=list(route=list(extravascular="VSSF/FP", intravascular="VSSP")), @@ -1226,7 +1227,7 @@ add.interval.col("vss.last", values=c(FALSE, TRUE), unit_type="volume", pretty_name="Vss (based on AUClast)", - desc="The steady-state volume of distribution calculating through Tlast", + desc="Vss, calc'd through Tlast", formalsmap=list(cl="cl.last", mrt="mrt.last"), depends=c("cl.last", "mrt.last"), pptestcd_cdisc=list(route=list(extravascular="VSSF/FLST", intravascular="VSSLST")), @@ -1237,7 +1238,7 @@ add.interval.col("vss.iv.obs", values=c(FALSE, TRUE), unit_type="volume", pretty_name="Vss (for IV dosing, based on AUCinf,obs)", - desc="The steady-state volume of distribution with intravenous infusion using observed Clast", + desc="IV Vss, observed Clast", formalsmap=list(cl="cl.obs", mrt="mrt.iv.obs"), depends=c("cl.obs", "mrt.iv.obs"), pptestcd_cdisc="VSSIVO", @@ -1248,7 +1249,7 @@ add.interval.col("vss.iv.pred", values=c(FALSE, TRUE), unit_type="volume", pretty_name="Vss (for IV dosing, based on AUCinf,pred)", - desc="The steady-state volume of distribution with intravenous infusion using predicted Clast", + desc="IV Vss, predicted Clast", formalsmap=list(cl="cl.pred", mrt="mrt.iv.pred"), depends=c("cl.pred", "mrt.iv.pred"), pptestcd_cdisc="VSSIVP", @@ -1259,7 +1260,7 @@ add.interval.col("vss.iv.last", values=c(FALSE, TRUE), unit_type="volume", pretty_name="Vss (for IV dosing, based on AUClast)", - desc="The steady-state volume of distribution with intravenous infusion calculating through Tlast", + desc="IV Vss, calc from AUClast", formalsmap=list(cl="cl.last", mrt="mrt.iv.last"), depends=c("cl.last", "mrt.iv.last"), pptestcd_cdisc="VSSIVLST", @@ -1270,7 +1271,7 @@ add.interval.col("vss.md.obs", values=c(FALSE, TRUE), unit_type="volume", pretty_name="Vss (for multiple-dose, based on Clast,obs)", - desc="The steady-state volume of distribution for nonlinear multiple-dose data using observed Clast", + desc="Vss, multi-dose, obs", formalsmap=list(cl="cl.last", mrt="mrt.md.obs"), depends=c("cl.last", "mrt.md.obs"), pptestcd_cdisc="VSSMDO", @@ -1281,7 +1282,7 @@ add.interval.col("vss.md.pred", values=c(FALSE, TRUE), unit_type="volume", pretty_name="Vss (for multiple-dose, based on Clast,pred)", - desc="The steady-state volume of distribution for nonlinear multiple-dose data using predicted Clast", + desc="Vss, multi-dose, pred", formalsmap=list(cl="cl.last", mrt="mrt.md.pred"), depends=c("cl.last", "mrt.md.pred"), pptestcd_cdisc="VSSMDP", @@ -1292,7 +1293,7 @@ add.interval.col("vss.all", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vss (based on AUCall)", - desc = "Steady-state volume of distribution calculated with AUCall-based CL and MRT", + desc = "Vss, calc from AUCall", formalsmap = list(cl = "cl.all", mrt = "mrt.all"), depends = c("cl.all", "mrt.all")) @@ -1301,7 +1302,7 @@ add.interval.col("vss.int.all", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vss (based on AUCint.all)", - desc = "Steady-state volume of distribution using interval AUCint.all", + desc = "Vss, calc from interval AUCint.all", formalsmap = list(cl = "cl.int.all", mrt = "mrt.int.all"), depends = c("cl.int.all", "mrt.int.all")) @@ -1310,7 +1311,7 @@ add.interval.col("vss.int.inf.obs", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vss (based on AUCint.inf.obs)", - desc = "Steady-state volume of distribution using interval AUCint.inf.obs", + desc = "Vss, calc from interval AUCint.inf.obs", formalsmap = list(cl = "cl.int.inf.obs", mrt = "mrt.int.inf.obs"), depends = c("cl.int.inf.obs", "mrt.int.inf.obs")) @@ -1319,7 +1320,7 @@ add.interval.col("vss.int.inf.pred", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vss (based on AUCint.inf.pred)", - desc = "Steady-state volume of distribution using interval AUCint.inf.pred", + desc = "Vss, calc from interval AUCint.inf.pred", formalsmap = list(cl = "cl.int.inf.pred", mrt = "mrt.int.inf.pred"), depends = c("cl.int.inf.pred", "mrt.int.inf.pred")) @@ -1328,7 +1329,7 @@ add.interval.col("vss.int.last", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vss (based on AUCint.last)", - desc = "Steady-state volume of distribution using interval AUCint.last", + desc = "Vss, calc from interval AUCint.last", formalsmap = list(cl = "cl.int.last", mrt = "mrt.int.last"), depends = c("cl.int.last", "mrt.int.last")) @@ -1337,7 +1338,7 @@ add.interval.col("vss.iv.all", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vss (for IV dosing, based on AUCall)", - desc = "Steady-state volume of distribution for IV dosing using AUCall", + desc = "IV Vss, calc from AUCall", formalsmap = list(cl = "cl.iv.all", mrt = "mrt.iv.all"), depends = c("cl.iv.all", "mrt.iv.all")) @@ -1346,7 +1347,7 @@ add.interval.col("vss.ivint.all", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vss (IV dose interval, based on AUCint.all)", - desc = "Steady-state volume of distribution for IV interval using AUCint.all", + desc = "IV Vss, calc from interval AUCint.all", formalsmap = list(cl = "cl.ivint.all", mrt = "mrt.ivint.all"), depends = c("cl.ivint.all", "mrt.ivint.all")) @@ -1355,7 +1356,7 @@ add.interval.col("vss.ivint.last", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vss (IV dose interval, based on AUCint.last)", - desc = "Steady-state volume of distribution for IV interval using AUCint.last", + desc = "IV Vss, calc from interval AUCint.last", formalsmap = list(cl = "cl.ivint.last", mrt = "mrt.ivint.last"), depends = c("cl.ivint.last", "mrt.ivint.last")) @@ -1364,7 +1365,7 @@ add.interval.col("vss.sparse.last", values = c(FALSE, TRUE), unit_type = "volume", pretty_name = "Vss (for sparse data, based on AUClast)", - desc = "Steady-state volume of distribution from sparse sampling", + desc = "Vss, calc from sparse AUClast", sparse = TRUE, formalsmap = list(cl = "cl.sparse.last", mrt = "mrt.sparse.last"), depends = c("cl.sparse.last", "mrt.sparse.last")) @@ -1393,7 +1394,7 @@ add.interval.col( values = c(FALSE, TRUE), unit_type = "conc", pretty_name = "Cav", - desc = "The average concentration during an interval (calculated with AUClast)", + desc = "Avg conc in interval (AUClast)", depends = "auclast", formalsmap = list(auc = "auclast"), pptestcd_cdisc="CAVG", @@ -1405,7 +1406,7 @@ add.interval.col( values = c(FALSE, TRUE), unit_type = "conc", pretty_name = "Cav", - desc = "The average concentration during an interval (calculated with AUCint.last)", + desc = "Avg conc in interval (AUCint.last)", depends = "aucint.last", formalsmap = list(auc = "aucint.last"), pptestcd_cdisc="CAVGINT", @@ -1416,7 +1417,7 @@ add.interval.col( values = c(FALSE, TRUE), unit_type = "conc", pretty_name = "Cav", - desc = "The average concentration during an interval (calculated with AUCint.all)", + desc = "Avg conc in interval (AUCint.all)", depends = "aucint.all", formalsmap = list(auc = "aucint.all"), pptestcd_cdisc="CAVGINA", @@ -1427,7 +1428,7 @@ add.interval.col( values = c(FALSE, TRUE), unit_type = "conc", pretty_name = "Cav", - desc = "The average concentration during an interval (calculated with AUCint.inf.obs)", + desc = "Avg conc in interval (AUCint.inf.obs)", depends = "aucint.inf.obs", formalsmap = list(auc = "aucint.inf.obs"), pptestcd_cdisc="CAVGINO", @@ -1438,7 +1439,7 @@ add.interval.col( values = c(FALSE, TRUE), unit_type = "conc", pretty_name = "Cav", - desc = "The average concentration during an interval (calculated with AUCint.inf.pred)", + desc = "Avg conc in interval (AUCint.inf.pred)", depends = "aucint.inf.pred", formalsmap = list(auc = "aucint.inf.pred"), pptestcd_cdisc="CAVGINP", @@ -1470,7 +1471,7 @@ add.interval.col("ctrough", values=c(FALSE, TRUE), unit_type="conc", pretty_name="Ctrough", - desc="The trough (end of interval) concentration", + desc="Trough (end of interval) conc", depends=NULL, pptestcd_cdisc="CTROUGH", pptest_cdisc="Conc Trough") @@ -1523,7 +1524,7 @@ add.interval.col("ptr", values=c(FALSE, TRUE), unit_type="fraction", pretty_name="Peak-to-trough ratio", - desc="Peak-to-Trough ratio (fraction)", + desc="Peak-to-trough ratio", depends=c("cmax", "ctrough"), pptestcd_cdisc="PTROUGHR", pptest_cdisc="Peak Trough Ratio") @@ -1670,7 +1671,7 @@ add.interval.col( FUN="pk.calc.aucabove", unit_type="auc", pretty_name="AUC,above", - desc="The area under the concentration time the beginning of the interval to the last concentration above the limit of quantification plus the triangle from that last concentration to 0 at the first concentration below the limit of quantification, with a concentration subtracted from all concentrations and values below zero after subtraction set to zero", + desc="AUC above predose, floor at 0", depends="cstart", formalsmap = list(conc_above = "cstart"), pptestcd_cdisc="AUCABVPA", @@ -1681,7 +1682,7 @@ add.interval.col( FUN="pk.calc.aucabove", unit_type="auc", pretty_name="AUC,above", - desc="The area under the concentration time the beginning of the interval to the last concentration above the limit of quantification plus the triangle from that last concentration to 0 at the first concentration below the limit of quantification, with a concentration subtracted from all concentrations and values below zero after subtraction set to zero", + desc="AUC above trough, floor at 0", depends="ctrough", formalsmap = list(conc_above = "ctrough"), pptestcd_cdisc="AUCABVTA", @@ -1713,7 +1714,7 @@ add.interval.col( values = c(FALSE, TRUE), unit_type = "count", pretty_name = "Concentration count", - desc = "Number of non-missing concentrations for an interval", + desc = "Count of non-missing conc", depends = NULL, pptestcd_cdisc="CNTCONC", pptest_cdisc="Concentration count") @@ -1738,7 +1739,7 @@ add.interval.col( values=c(FALSE, TRUE), unit_type="count", pretty_name="Measured concentration count", - desc="Number of measured and non BLQ/ALQ concentrations for an interval", + desc="Count of measured, non-BLQ conc", depends=NULL ) @@ -1757,7 +1758,7 @@ add.interval.col( values=c(FALSE, TRUE), unit_type="dose", pretty_name="Total dose", - desc="Total dose administered during an interval", + desc="Total dose given in interval", pptestcd_cdisc="TDOSE", pptest_cdisc="Total dose administered") diff --git a/R/pk.calc.urine.R b/R/pk.calc.urine.R index 4a95bdd2..b2b1c66b 100644 --- a/R/pk.calc.urine.R +++ b/R/pk.calc.urine.R @@ -1,323 +1,323 @@ -#' Calculate the total urine volume -#' -#' @param volume The volume (or mass) of the sample -#' @return The sum of urine volumes for the interval -#' @family Urine/Excretion parameters -#' @export -pk.calc.volpk <- function(volume) { - if (length(volume) == 0) return(NA_real_) - sum(volume) -} -add.interval.col("volpk", - FUN="pk.calc.volpk", - values=c(FALSE, TRUE), - unit_type="volume", - pretty_name="Total Urine Volume", - desc="The sum of urine volumes for the interval", - pptestcd_cdisc="VOLPK", - pptest_cdisc="Volume of PK sample") - -#' Calculate amount excreted (typically in urine or feces) -#' -#' @details ae is `sum(conc*volume)`. -#' -#' @inheritParams assert_conc_time -#' @param volume The volume (or mass) of the sample -#' @param check Should the concentration and volume data be checked? -#' @return The amount excreted during the interval -#' @details The units for the concentration and volume should match such that -#' `sum(conc*volume)` has units of mass or moles. -#' @seealso [pk.calc.clr()], [pk.calc.fe()] -#' @family Urine/Excretion parameters -#' @export -pk.calc.ae <- function(conc, volume, check=TRUE) { - # Generate combined missing-data messages for conc/volume using helper - message_all <- generate_missing_messages(conc, volume, - name_a = "concentrations", - name_b = "volumes") - - ret <- sum(conc * volume) - if (length(message_all) != 0) { - message <- paste(message_all, collapse = "; ") - ret <- structure(ret, exclude = message) - } - ret -} -add.interval.col("ae", - FUN="pk.calc.ae", - values=c(FALSE, TRUE), - unit_type="amount", - pretty_name="Amount excreted", - desc="The amount excreted (typically into urine or feces)", - pptestcd_cdisc="RCAMINT", - pptest_cdisc="Amt Rec from T1 to T2") - -#' Calculate renal clearance -#' -#' @details clr is `sum(ae)/auc`. -#' -#' @param ae The amount excreted in urine (as a numeric scalar or vector) -#' @param auc The area under the curve (as a numeric scalar or vector) -#' @returns The renal clearance as a number -#' @details The units for the `ae` and `auc` should match such that `ae/auc` has -#' units of volume/time. -#' @seealso [pk.calc.ae()], [pk.calc.fe()] -#' @family Urine/Excretion parameters -#' @export -pk.calc.clr <- function(ae, auc) { - sum(ae)/auc -} -add.interval.col("clr.last", - FUN="pk.calc.clr", - values=c(FALSE, TRUE), - unit_type="renal_clearance", - pretty_name="Renal clearance (from AUClast)", - formalsmap=list(auc="auclast"), - depends="ae", - desc="The renal clearance calculated using AUClast", - pptestcd_cdisc="RENALCL", - pptest_cdisc="Renal CL") - -add.interval.col("clr.obs", - FUN="pk.calc.clr", - values=c(FALSE, TRUE), - unit_type="renal_clearance", - pretty_name="Renal clearance (from AUCinf,obs)", - formalsmap=list(auc="aucinf.obs"), - depends="ae", - desc="The renal clearance calculated using AUCinf,obs", - pptestcd_cdisc="RENALCL", - pptest_cdisc="Renal CL") - -add.interval.col("clr.pred", - FUN="pk.calc.clr", - values=c(FALSE, TRUE), - unit_type="renal_clearance", - pretty_name="Renal clearance (from AUCinf,pred)", - formalsmap=list(auc="aucinf.pred"), - depends="ae", - desc="The renal clearance calculated using AUCinf,pred", - pptestcd_cdisc="RENALCL", - pptest_cdisc="Renal CL") - - -#' Calculate fraction excreted (typically in urine or feces) -#' -#' @details fe is `sum(ae)/dose` -#' -#' @param ae The amount excreted (as a numeric scalar or vector) -#' @param dose The dose (as a numeric scalar or vector) -#' @returns The fraction of dose excreted -#' @details The units for `ae` and `dose` should be the same so that `ae/dose` -#' is a unitless fraction. -#' @seealso [pk.calc.ae()], [pk.calc.clr()] -#' @family Urine/Excretion parameters -#' @export -pk.calc.fe <- function(ae, dose) { - sum(ae)/dose -} -add.interval.col("fe", - FUN="pk.calc.fe", - unit_type="amount_dose", - pretty_name="Fraction excreted", - values=c(FALSE, TRUE), - depends="ae", - desc="The fraction of the dose excreted", - pptestcd_cdisc="FREXINT", - pptest_cdisc="Fract Excr from T1 to T2") - -#' Calculate the midpoint collection time of the last measurable excretion rate -#' -#' @param conc The concentration in the excreta (e.g., urine or feces) -#' @param volume The volume (or mass) of the sample -#' @param time The starting time of the collection interval -#' @param duration.conc The duration of the collection interval -#' @param check Should the concentration and time data be checked? -#' @return The midpoint collection time of the last measurable excretion rate, or NA/0 if not available -#' @family Urine/Excretion parameters -#' @export -pk.calc.ertlst <- function(conc, volume, time, duration.conc, check = TRUE) { - - # Generate messages about missing concentrations/volumes - message_all <- generate_missing_messages(conc, volume, - name_a = "concentrations", - name_b = "volumes") - - er <- conc * volume / duration.conc - - if (all(is.na(er))) { - ret <- NA_real_ - } else if (all(er %in% c(0, NA))) { - ret <- 0 - } else { - midtime <- time + duration.conc / 2 - ret <- max(midtime[!is.na(er) & er != 0]) - } - - if (length(message_all) != 0) { - message <- paste(message_all, collapse = "; ") - ret <- structure(ret, exclude = message) - } - ret -} - -# Add the column to the interval specification -add.interval.col("ertlst", - FUN="pk.calc.ertlst", - unit_type="time", - pretty_name="Tlast excretion rate", - desc="The midpoint collection time of the last measurable excretion rate (typically in urine or feces)", - pptestcd_cdisc="ERTLST", - pptest_cdisc="Time of Last Excretion Rate") - - -#' Calculate the maximum excretion rate -#' -#' @param conc The concentration in the excreta (e.g., urine or feces) -#' @param volume The volume (or mass) of the sample -#' @param time The starting time of the collection interval -#' @param duration.conc The duration of the collection interval -#' @param check Should the concentration data be checked? -#' @return The maximum excretion rate, or NA if not available -#' @family Urine/Excretion parameters -#' @export -pk.calc.ermax <- function(conc, volume, time, duration.conc, check = TRUE) { - - # Generate messages about missing concentrations/volumes - message_all <- generate_missing_messages(conc, volume, - name_a = "concentrations", - name_b = "volumes") - - if (length(conc) == 0 || all(is.na(conc))) { - ret <- NA_real_ - } else { - er <- conc * volume / duration.conc - if (all(is.na(er))) { - ret <- NA_real_ - } else { - ret <- max(er, na.rm=TRUE) - } - } - - if (length(message_all) != 0) { - message <- paste(message_all, collapse = "; ") - ret <- structure(ret, exclude = message) - } - ret -} - -add.interval.col("ermax", - FUN="pk.calc.ermax", - unit_type="amount_time", - pretty_name="Maximum excretion rate", - desc="The maximum excretion rate (typically in urine or feces)", - pptestcd_cdisc="ERMAX", - pptest_cdisc="Max Excretion Rate") - - -#' Calculate the midpoint collection time of the maximum excretion rate -#' -#' @param conc The concentration in the excreta (e.g., urine or feces) -#' @param volume The volume (or mass) of the sample -#' @param time The starting time of the collection interval -#' @param duration.conc The duration of the collection interval -#' @inheritParams PKNCA.choose.option -#' @param check Should the concentration and time data be checked? -#' @param first.tmax If TRUE, return the first time of maximum excretion rate; otherwise, return the last -#' @return The midpoint collection time of the maximum excretion rate, or NA if not available -#' @family Urine/Excretion parameters -#' @export -pk.calc.ertmax <- function(conc, volume, time, duration.conc, options = list(), check = TRUE, first.tmax = NULL) { - first.tmax <- PKNCA.choose.option(name="first.tmax", value=first.tmax, options=options) - - # Generate messages about missing concentrations/volumes - message_all <- generate_missing_messages(conc, volume, - name_a = "concentrations", - name_b = "volumes") - - if (length(conc) == 0 || all(conc %in% c(NA, 0))) { - ret <- NA_real_ - } else { - er <- conc * volume / duration.conc - ermax <- pk.calc.ermax(conc, volume, time, duration.conc, check = FALSE) - midtime <- time + duration.conc / 2 - ret <- midtime[er %in% ermax] - - if (first.tmax) { - ret <- ret[1] - } else { - ret <- ret[length(ret)] - } - } - - if (length(message_all) != 0) { - message <- paste(message_all, collapse = "; ") - ret <- structure(ret, exclude = message) - } - ret -} - -add.interval.col("ertmax", - FUN="pk.calc.ertmax", - unit_type="time", - pretty_name="Tmax excretion rate", - desc="The midpoint collection time of the maximum excretion rate (typically in urine or feces)", - pptestcd_cdisc="ERTMAX", - pptest_cdisc="Midpoint of Interval of Maximum ER") - -PKNCA.set.summary( - name = c("volpk", "ae", "clr.last", "clr.obs", "clr.pred", "fe", "ermax"), - description = "geometric mean and geometric coefficient of variation", - point = business.geomean, - spread = business.geocv -) - -PKNCA.set.summary( - name = c("ertlst", "ertmax"), - description = "median and range", - point = business.median, - spread = business.range -) - - -# Helper to generate missing-data checking messages for paired vectors -# -# This function accepts two columns/vectors (for example, concentrations -# and volumes). It computes missingness internally and produces a character -# vector of human-readable messages describing the missingness that matches -# the style used in the package (used previously in `pk.calc.ae`). -generate_missing_messages <- function(a, b, - name_a = deparse(substitute(a)), - name_b = deparse(substitute(b))) { - - mask_a <- is.na(a) - mask_b <- is.na(b) - - mask_both <- mask_a & mask_b - mask_a_only <- mask_a & !mask_both - mask_b_only <- mask_b & !mask_both - - msg_both <- msg_a <- msg_b <- NA_character_ - n <- length(mask_a) - - if (all(mask_both)) { - msg_both <- sprintf("All %s and %s are missing", name_a, name_b) - } else if (any(mask_both)) { - msg_both <- sprintf("%g of %g %s and %s are missing", sum(mask_both), n, name_a, name_b) - } - - if (all(mask_a_only)) { - msg_a <- sprintf("All %s are missing", name_a) - } else if (any(mask_a_only)) { - msg_a <- sprintf("%g of %g %s are missing", sum(mask_a_only), n, name_a) - } - - if (all(mask_b_only)) { - msg_b <- sprintf("All %s are missing", name_b) - } else if (any(mask_b_only)) { - msg_b <- sprintf("%g of %g %s are missing", sum(mask_b_only), n, name_b) - } - - # Return non-NA messages - stats::na.omit(c(msg_both, msg_a, msg_b)) +#' Calculate the total urine volume +#' +#' @param volume The volume (or mass) of the sample +#' @return The sum of urine volumes for the interval +#' @family Urine/Excretion parameters +#' @export +pk.calc.volpk <- function(volume) { + if (length(volume) == 0) return(NA_real_) + sum(volume) +} +add.interval.col("volpk", + FUN="pk.calc.volpk", + values=c(FALSE, TRUE), + unit_type="volume", + pretty_name="Total Urine Volume", + desc="Sum of urine volumes for interval", + pptestcd_cdisc="VOLPK", + pptest_cdisc="Volume of PK sample") + +#' Calculate amount excreted (typically in urine or feces) +#' +#' @details ae is `sum(conc*volume)`. +#' +#' @inheritParams assert_conc_time +#' @param volume The volume (or mass) of the sample +#' @param check Should the concentration and volume data be checked? +#' @return The amount excreted during the interval +#' @details The units for the concentration and volume should match such that +#' `sum(conc*volume)` has units of mass or moles. +#' @seealso [pk.calc.clr()], [pk.calc.fe()] +#' @family Urine/Excretion parameters +#' @export +pk.calc.ae <- function(conc, volume, check=TRUE) { + # Generate combined missing-data messages for conc/volume using helper + message_all <- generate_missing_messages(conc, volume, + name_a = "concentrations", + name_b = "volumes") + + ret <- sum(conc * volume) + if (length(message_all) != 0) { + message <- paste(message_all, collapse = "; ") + ret <- structure(ret, exclude = message) + } + ret +} +add.interval.col("ae", + FUN="pk.calc.ae", + values=c(FALSE, TRUE), + unit_type="amount", + pretty_name="Amount excreted", + desc="Amount excreted (urine/feces)", + pptestcd_cdisc="RCAMINT", + pptest_cdisc="Amt Rec from T1 to T2") + +#' Calculate renal clearance +#' +#' @details clr is `sum(ae)/auc`. +#' +#' @param ae The amount excreted in urine (as a numeric scalar or vector) +#' @param auc The area under the curve (as a numeric scalar or vector) +#' @returns The renal clearance as a number +#' @details The units for the `ae` and `auc` should match such that `ae/auc` has +#' units of volume/time. +#' @seealso [pk.calc.ae()], [pk.calc.fe()] +#' @family Urine/Excretion parameters +#' @export +pk.calc.clr <- function(ae, auc) { + sum(ae)/auc +} +add.interval.col("clr.last", + FUN="pk.calc.clr", + values=c(FALSE, TRUE), + unit_type="renal_clearance", + pretty_name="Renal clearance (from AUClast)", + formalsmap=list(auc="auclast"), + depends="ae", + desc="Renal clearance, AUClast", + pptestcd_cdisc="RENALCL", + pptest_cdisc="Renal CL") + +add.interval.col("clr.obs", + FUN="pk.calc.clr", + values=c(FALSE, TRUE), + unit_type="renal_clearance", + pretty_name="Renal clearance (from AUCinf,obs)", + formalsmap=list(auc="aucinf.obs"), + depends="ae", + desc="Renal clearance, AUCinf,obs", + pptestcd_cdisc="RENALCL", + pptest_cdisc="Renal CL") + +add.interval.col("clr.pred", + FUN="pk.calc.clr", + values=c(FALSE, TRUE), + unit_type="renal_clearance", + pretty_name="Renal clearance (from AUCinf,pred)", + formalsmap=list(auc="aucinf.pred"), + depends="ae", + desc="Renal clearance, AUCinf,pred", + pptestcd_cdisc="RENALCL", + pptest_cdisc="Renal CL") + + +#' Calculate fraction excreted (typically in urine or feces) +#' +#' @details fe is `sum(ae)/dose` +#' +#' @param ae The amount excreted (as a numeric scalar or vector) +#' @param dose The dose (as a numeric scalar or vector) +#' @returns The fraction of dose excreted +#' @details The units for `ae` and `dose` should be the same so that `ae/dose` +#' is a unitless fraction. +#' @seealso [pk.calc.ae()], [pk.calc.clr()] +#' @family Urine/Excretion parameters +#' @export +pk.calc.fe <- function(ae, dose) { + sum(ae)/dose +} +add.interval.col("fe", + FUN="pk.calc.fe", + unit_type="amount_dose", + pretty_name="Fraction excreted", + values=c(FALSE, TRUE), + depends="ae", + desc="Fraction of dose excreted", + pptestcd_cdisc="FREXINT", + pptest_cdisc="Fract Excr from T1 to T2") + +#' Calculate the midpoint collection time of the last measurable excretion rate +#' +#' @param conc The concentration in the excreta (e.g., urine or feces) +#' @param volume The volume (or mass) of the sample +#' @param time The starting time of the collection interval +#' @param duration.conc The duration of the collection interval +#' @param check Should the concentration and time data be checked? +#' @return The midpoint collection time of the last measurable excretion rate, or NA/0 if not available +#' @family Urine/Excretion parameters +#' @export +pk.calc.ertlst <- function(conc, volume, time, duration.conc, check = TRUE) { + + # Generate messages about missing concentrations/volumes + message_all <- generate_missing_messages(conc, volume, + name_a = "concentrations", + name_b = "volumes") + + er <- conc * volume / duration.conc + + if (all(is.na(er))) { + ret <- NA_real_ + } else if (all(er %in% c(0, NA))) { + ret <- 0 + } else { + midtime <- time + duration.conc / 2 + ret <- max(midtime[!is.na(er) & er != 0]) + } + + if (length(message_all) != 0) { + message <- paste(message_all, collapse = "; ") + ret <- structure(ret, exclude = message) + } + ret +} + +# Add the column to the interval specification +add.interval.col("ertlst", + FUN="pk.calc.ertlst", + unit_type="time", + pretty_name="Tlast excretion rate", + desc="Midpoint time of last excr rate", + pptestcd_cdisc="ERTLST", + pptest_cdisc="Time of Last Excretion Rate") + + +#' Calculate the maximum excretion rate +#' +#' @param conc The concentration in the excreta (e.g., urine or feces) +#' @param volume The volume (or mass) of the sample +#' @param time The starting time of the collection interval +#' @param duration.conc The duration of the collection interval +#' @param check Should the concentration data be checked? +#' @return The maximum excretion rate, or NA if not available +#' @family Urine/Excretion parameters +#' @export +pk.calc.ermax <- function(conc, volume, time, duration.conc, check = TRUE) { + + # Generate messages about missing concentrations/volumes + message_all <- generate_missing_messages(conc, volume, + name_a = "concentrations", + name_b = "volumes") + + if (length(conc) == 0 || all(is.na(conc))) { + ret <- NA_real_ + } else { + er <- conc * volume / duration.conc + if (all(is.na(er))) { + ret <- NA_real_ + } else { + ret <- max(er, na.rm=TRUE) + } + } + + if (length(message_all) != 0) { + message <- paste(message_all, collapse = "; ") + ret <- structure(ret, exclude = message) + } + ret +} + +add.interval.col("ermax", + FUN="pk.calc.ermax", + unit_type="amount_time", + pretty_name="Maximum excretion rate", + desc="Maximum excretion rate", + pptestcd_cdisc="ERMAX", + pptest_cdisc="Max Excretion Rate") + + +#' Calculate the midpoint collection time of the maximum excretion rate +#' +#' @param conc The concentration in the excreta (e.g., urine or feces) +#' @param volume The volume (or mass) of the sample +#' @param time The starting time of the collection interval +#' @param duration.conc The duration of the collection interval +#' @inheritParams PKNCA.choose.option +#' @param check Should the concentration and time data be checked? +#' @param first.tmax If TRUE, return the first time of maximum excretion rate; otherwise, return the last +#' @return The midpoint collection time of the maximum excretion rate, or NA if not available +#' @family Urine/Excretion parameters +#' @export +pk.calc.ertmax <- function(conc, volume, time, duration.conc, options = list(), check = TRUE, first.tmax = NULL) { + first.tmax <- PKNCA.choose.option(name="first.tmax", value=first.tmax, options=options) + + # Generate messages about missing concentrations/volumes + message_all <- generate_missing_messages(conc, volume, + name_a = "concentrations", + name_b = "volumes") + + if (length(conc) == 0 || all(conc %in% c(NA, 0))) { + ret <- NA_real_ + } else { + er <- conc * volume / duration.conc + ermax <- pk.calc.ermax(conc, volume, time, duration.conc, check = FALSE) + midtime <- time + duration.conc / 2 + ret <- midtime[er %in% ermax] + + if (first.tmax) { + ret <- ret[1] + } else { + ret <- ret[length(ret)] + } + } + + if (length(message_all) != 0) { + message <- paste(message_all, collapse = "; ") + ret <- structure(ret, exclude = message) + } + ret +} + +add.interval.col("ertmax", + FUN="pk.calc.ertmax", + unit_type="time", + pretty_name="Tmax excretion rate", + desc="Midpoint time of max excr rate", + pptestcd_cdisc="ERTMAX", + pptest_cdisc="Midpoint of Interval of Maximum ER") + +PKNCA.set.summary( + name = c("volpk", "ae", "clr.last", "clr.obs", "clr.pred", "fe", "ermax"), + description = "geometric mean and geometric coefficient of variation", + point = business.geomean, + spread = business.geocv +) + +PKNCA.set.summary( + name = c("ertlst", "ertmax"), + description = "median and range", + point = business.median, + spread = business.range +) + + +# Helper to generate missing-data checking messages for paired vectors +# +# This function accepts two columns/vectors (for example, concentrations +# and volumes). It computes missingness internally and produces a character +# vector of human-readable messages describing the missingness that matches +# the style used in the package (used previously in `pk.calc.ae`). +generate_missing_messages <- function(a, b, + name_a = deparse(substitute(a)), + name_b = deparse(substitute(b))) { + + mask_a <- is.na(a) + mask_b <- is.na(b) + + mask_both <- mask_a & mask_b + mask_a_only <- mask_a & !mask_both + mask_b_only <- mask_b & !mask_both + + msg_both <- msg_a <- msg_b <- NA_character_ + n <- length(mask_a) + + if (all(mask_both)) { + msg_both <- sprintf("All %s and %s are missing", name_a, name_b) + } else if (any(mask_both)) { + msg_both <- sprintf("%g of %g %s and %s are missing", sum(mask_both), n, name_a, name_b) + } + + if (all(mask_a_only)) { + msg_a <- sprintf("All %s are missing", name_a) + } else if (any(mask_a_only)) { + msg_a <- sprintf("%g of %g %s are missing", sum(mask_a_only), n, name_a) + } + + if (all(mask_b_only)) { + msg_b <- sprintf("All %s are missing", name_b) + } else if (any(mask_b_only)) { + msg_b <- sprintf("%g of %g %s are missing", sum(mask_b_only), n, name_b) + } + + # Return non-NA messages + stats::na.omit(c(msg_both, msg_a, msg_b)) } \ No newline at end of file diff --git a/R/sparse.R b/R/sparse.R index cc15376a..eb62b5c9 100644 --- a/R/sparse.R +++ b/R/sparse.R @@ -384,7 +384,7 @@ add.interval.col( values=c(FALSE, TRUE), unit_type="auc", pretty_name="Sparse AUClast", - desc="For sparse PK sampling, the area under the concentration time curve from the beginning of the interval to the last concentration above the limit of quantification", + desc="Sparse AUC to last conc above LOQ", pptestcd_cdisc="SPARSEAL", pptest_cdisc="Sparse AUClast" ) @@ -395,7 +395,7 @@ add.interval.col( values=c(FALSE, TRUE), unit_type="auc", pretty_name="Sparse AUClast standard error", - desc="For sparse PK sampling, the standard error of the area under the concentration time curve from the beginning of the interval to the last concentration above the limit of quantification", + desc="SE of sparse AUC to last conc above LOQ", depends="sparse_auclast", pptestcd_cdisc="SPARSEAS", pptest_cdisc="Sparse AUClast standard error" @@ -407,7 +407,7 @@ add.interval.col( values=c(FALSE, TRUE), unit_type="count", pretty_name="Sparse AUClast degrees of freedom", - desc="For sparse PK sampling, the standard error degrees of freedom of the area under the concentration time curve from the beginning of the interval to the last concentration above the limit of quantification", + desc="DF for sparse AUC to last conc above LOQ", depends="sparse_auclast", pptestcd_cdisc="SPARSEAD", pptest_cdisc="Sparse AUClast degrees of freedom" @@ -605,7 +605,7 @@ add.interval.col( values = c(FALSE, TRUE), unit_type = "aumc", pretty_name = "Sparse AUMClast", - desc = "For sparse PK sampling, the area under the moment curve from the beginning of the interval to the last concentration above the limit of quantification", + desc = "Sparse AUMC to last conc above LOQ", depends = "sparse_auclast" ) @@ -615,7 +615,7 @@ add.interval.col( values = c(FALSE, TRUE), unit_type = "aumc", pretty_name = "Sparse AUMC standard error", - desc = "For sparse PK sampling, the standard error of the area under the moment curve", + desc = "SE of sparse AUMC to last conc above LOQ", depends = "sparse_aumclast" ) @@ -625,7 +625,7 @@ add.interval.col( values = c(FALSE, TRUE), unit_type = "count", pretty_name = "Sparse AUMC degrees of freedom", - desc = "For sparse PK sampling, the degrees of freedom for the AUMC variance estimate", + desc = "variance DF for sparse AUMC to Tlast", depends = "sparse_aumclast" ) diff --git a/man/filter.PKNCAresults.Rd b/man/filter.PKNCAresults.Rd index 3898cac3..9816d574 100644 --- a/man/filter.PKNCAresults.Rd +++ b/man/filter.PKNCAresults.Rd @@ -18,14 +18,14 @@ lazy data frame (e.g. from dbplyr or dtplyr). See \emph{Methods}, below, for more details.} \item{...}{<\code{\link[rlang:args_data_masking]{data-masking}}> Expressions that -return a logical vector, defined in terms of the variables in \code{.data}. If -multiple expressions are included, they are combined with the \code{&} operator. -To combine expressions using \code{|} instead, wrap them in \code{\link[dplyr:when_any]{when_any()}}. Only -rows for which all expressions evaluate to \code{TRUE} are kept (for \code{filter()}) -or dropped (for \code{filter_out()}).} +return a logical value, and are defined in terms of the variables in +\code{.data}. If multiple expressions are included, they are combined with the +\code{&} operator. Only rows for which all conditions evaluate to \code{TRUE} are +kept.} -\item{.preserve}{Relevant when the \code{.data} input is grouped. If \code{.preserve = FALSE} (the default), the grouping structure is recalculated based on the -resulting data, otherwise the grouping is kept as is.} +\item{.preserve}{Relevant when the \code{.data} input is grouped. +If \code{.preserve = FALSE} (the default), the grouping structure +is recalculated based on the resulting data, otherwise the grouping is kept as is.} } \description{ dplyr filtering for PKNCA diff --git a/man/group_by.PKNCAresults.Rd b/man/group_by.PKNCAresults.Rd index 104f671a..adff58a5 100644 --- a/man/group_by.PKNCAresults.Rd +++ b/man/group_by.PKNCAresults.Rd @@ -26,16 +26,20 @@ lazy data frame (e.g. from dbplyr or dtplyr). See \emph{Methods}, below, for more details.} -\item{...}{<\code{\link[rlang:args_data_masking]{data-masking}}> In \code{group_by()}, -variables or computations to group by. Computations are always done on the -ungrouped data frame. To perform computations on the grouped data, you need -to use a separate \code{mutate()} step before the \code{group_by()}. +\item{...}{In \code{group_by()}, variables or computations to group by. +Computations are always done on the ungrouped data frame. +To perform computations on the grouped data, you need to use +a separate \code{mutate()} step before the \code{group_by()}. Computations are not allowed in \code{nest_by()}. In \code{ungroup()}, variables to remove from the grouping.} \item{.add}{When \code{FALSE}, the default, \code{group_by()} will override existing groups. To add to the existing groups, use -\code{.add = TRUE}.} +\code{.add = TRUE}. + +This argument was previously called \code{add}, but that prevented +creating a new grouping variable called \code{add}, and conflicts with +our naming conventions.} \item{.drop}{Drop groups formed by factor levels that don't appear in the data? The default is \code{TRUE} except when \code{.data} has been previously diff --git a/tests/testthat/test-001-add.interval.col.R b/tests/testthat/test-001-add.interval.col.R index 88334d0e..524de067 100644 --- a/tests/testthat/test-001-add.interval.col.R +++ b/tests/testthat/test-001-add.interval.col.R @@ -66,30 +66,49 @@ test_that("add.interval.col", { ) # description + ## validates desc + # ---- Valid boundary: exactly 40 characters ---- + expect_no_error( + add.interval.col( + name="a", FUN=NA, unit_type="conc", pretty_name="a", datatype="interval", desc = paste(rep("a", 40), collapse = "") ) + ) + + # ---- Invalid boundary: 41 characters ---- expect_error( - add.interval.col(name = "a", FUN = NA, unit_type = "conc", pretty_name = "a", datatype = "interval", desc = 1:2), - regexp = "Must be of type 'character'" + add.interval.col(name="a", FUN=NA, unit_type="conc", pretty_name="a", datatype="interval", desc = paste(rep("a", 41), collapse = "") ) ) + + # ---- NA ---- expect_error( - add.interval.col(name = "a", FUN = NA, unit_type = "conc", pretty_name = "a", datatype = "interval", desc = 1), - regexp = "Must be of type 'character'" + add.interval.col(name="a", FUN=NA, unit_type="conc", pretty_name="a", datatype="interval", desc = NA_character_ ) ) + + # ---- Zero-length character ---- expect_error( - add.interval.col( - name = "a", FUN = NA, unit_type = "conc", - pretty_name = "a", datatype = "interval", desc = NA_character_ - ), - regexp = "Contains missing values" + add.interval.col(name="a", FUN=NA, unit_type="conc", pretty_name="a", datatype="interval", desc = character(0) ) ) + + # ---- Length > 1 ---- expect_error( - add.interval.col( - name = "a", FUN = NA, unit_type = "conc", - pretty_name = "a", datatype = "interval", - desc = c("a", "b") - ), + add.interval.col(name="a", FUN=NA, unit_type="conc", pretty_name="a", datatype="interval", desc = c("a", "b") ) + ) + + # ---- Wrong type (numeric, not character) ---- + expect_error( + add.interval.col(name="a", FUN=NA, unit_type="conc", pretty_name="a", datatype="interval", desc = 123 ) + ) + + expect_error( + add.interval.col(name="a", FUN=NA, depends = 1, unit_type="conc", pretty_name="a", datatype="interval", desc=1), + regexp="Must be of type 'character'", + info="depends column must be a NULL or a character string" + ) + + expect_error( + add.interval.col(name = "a", FUN = NA, unit_type = "conc", pretty_name = "a", datatype = "interval", desc = c("a", "b")), regexp = "Must have length 1" ) - + # depends expect_error( add.interval.col(name = "a", FUN = NA, depends = 1, unit_type = "conc", pretty_name = "a", datatype = "interval", desc = "a"), @@ -98,19 +117,11 @@ test_that("add.interval.col", { # values expect_error( - add.interval.col( - name = "a", FUN = NA, unit_type = "conc", - pretty_name = "a", datatype = "interval", desc = "a", - values = NULL - ), + add.interval.col(name = "a", FUN = NA, unit_type = "conc", pretty_name = "a", datatype = "interval", desc = "a", values = NULL), class = "pknca_error_values_invalid" ) expect_error( - add.interval.col( - name = "a", FUN = NA, unit_type = "conc", - pretty_name = "a", datatype = "interval", desc = "a", - values = quote(x) - ), + add.interval.col(name = "a", FUN = NA, unit_type = "conc", pretty_name = "a", datatype = "interval", desc = "a", values = quote(x) ), class = "pknca_error_values_invalid" ) diff --git a/tests/testthat/test-pk.calc.all.R b/tests/testthat/test-pk.calc.all.R index ae3a541c..fe6b4cc9 100644 --- a/tests/testthat/test-pk.calc.all.R +++ b/tests/testthat/test-pk.calc.all.R @@ -1035,7 +1035,7 @@ test_that("pk.nca.interval covers route, volume.group, duration.conc.group, dose FUN = fn_name, unit_type = "conc", pretty_name = "Test: group arg branches", - desc = "Coverage test for group argument branches in pk.nca.interval" + desc = "Coverage test for group arg branches" ) d <- as.data.frame(datasets::Theoph[datasets::Theoph$Subject == "1", ])