From 4059d1dd5b5d5e28dc0c6dad5d1bf3fe70636438 Mon Sep 17 00:00:00 2001 From: Bill Denney Date: Thu, 24 Oct 2024 12:18:10 -0400 Subject: [PATCH 1/5] Rebuild docs (no code changes) --- man/reexports.Rd | 1 - man/rxode2.Rd | 77 ++++++++++++++++++++---------------------------- 2 files changed, 32 insertions(+), 46 deletions(-) diff --git a/man/reexports.Rd b/man/reexports.Rd index 2857ff16d..8cba3d62e 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -38,4 +38,3 @@ below to see their documentation. \item{magrittr}{\code{\link[magrittr:pipe]{\%>\%}}} }} -\value{ Inherited from parent routine } diff --git a/man/rxode2.Rd b/man/rxode2.Rd index 908b50cc3..ec4f1d898 100644 --- a/man/rxode2.Rd +++ b/man/rxode2.Rd @@ -218,10 +218,7 @@ drug-disease modeling, etc. The ODE-based model specification may be coded inside four places: \itemize{ \item Inside a \code{rxode2({})} block statements: -}\if{html}{\out{ - -}} - +} \if{html}{\out{
}}\preformatted{library(rxode2) mod <- rxode2(\{ @@ -234,10 +231,7 @@ mod <- rxode2(\{ }\if{html}{\out{
}} \itemize{ \item Inside a \code{rxode2("")} string statement: -}\if{html}{\out{ - -}} - +} \if{html}{\out{
}}\preformatted{mod <- rxode2(" # simple assignment @@ -249,10 +243,7 @@ mod <- rxode2(\{ }\if{html}{\out{
}} \itemize{ \item In a file name to be loaded by rxode2: -}\if{html}{\out{ - -}} - +} \if{html}{\out{
}}\preformatted{writeLines(" # simple assignment @@ -266,10 +257,7 @@ unlink("modelFile.rxode2") }\if{html}{\out{
}} \itemize{ \item In a model function which can be parsed by \code{rxode2}: -}\if{html}{\out{ - -}} - +} \if{html}{\out{
}}\preformatted{mod <- function() \{ model(\{ @@ -347,9 +335,9 @@ Assignment statements can be: \itemize{ \item \strong{simple} assignments, where the left hand is an identifier (i.e., variable). This includes string assignments -\item special \strong{time-derivative} assignments, where the left hand -specifies the change of the amount in the corresponding state -variable (compartment) with respect to time e.g., \code{d/dt(depot)}: +\item special \strong{time-derivative} assignments, where the left hand specifies +the change of the amount in the corresponding state variable +(compartment) with respect to time e.g., \code{d/dt(depot)}: \item special \strong{initial-condition} assignments where the left hand specifies the compartment of the initial condition being specified, e.g. \code{depot(0) = 0} @@ -358,20 +346,20 @@ e.g. \code{depot(0) = 0} (\code{rate(depot)=2}) and \strong{modeled duration} (\code{dur(depot)=2}). An example of these model features and the event specification for the modeled infusions the rxode2 data specification is found in \href{https://nlmixr2.github.io/rxode2/articles/rxode2-event-types.html}{rxode2 events vignette}. -\item special \strong{change point syntax, or model times}. These model times -are specified by \code{mtime(var)=time} +\item special \strong{change point syntax, or model times}. These model times are +specified by \code{mtime(var)=time} \item special \strong{Jacobian-derivative} assignments, where the left hand specifies the change in the compartment ode with respect to a variable. For example, if \code{d/dt(y) = dy}, then a Jacobian for this -compartment can be specified as \code{df(y)/dy(dy) = 1}. There may be -some advantage to obtaining the solution or specifying the Jacobian -for very stiff ODE systems. However, for the few stiff systems we -tried with LSODA, this actually slightly slowed down the solving. -\item Special \strong{string value declarations} which tell what values a -string variable will take within a \code{rxode2} solving structure. These -values will then cause a factor to be created for this variable on -solving the \code{rxode2} model. As such, they are declared in much the -same way as \code{R}, that is: \code{labels(a) <- c("a1", "a2")}. +compartment can be specified as \code{df(y)/dy(dy) = 1}. There may be some +advantage to obtaining the solution or specifying the Jacobian for +very stiff ODE systems. However, for the few stiff systems we tried +with LSODA, this actually slightly slowed down the solving. +\item Special \strong{string value declarations} which tell what values a string +variable will take within a \code{rxode2} solving structure. These values +will then cause a factor to be created for this variable on solving +the \code{rxode2} model. As such, they are declared in much the same way as +\code{R}, that is: \code{labels(a) <- c("a1", "a2")}. } Note that assignment can be done by \code{=}, \verb{<-} or \code{~}. @@ -389,14 +377,14 @@ add extra compartment names at the end (useful for multiple-endpoint nlmixr models); These are specified by \code{cmt(compartmentName)} \item \strong{Parameter declaration statements}, which can make sure the input parameters are in a certain order instead of ordering the parameters -by the order they are parsed. This is useful for keeping the -parameter order the same when using 2 different ODE models. These -are specified by \code{param(par1, par2,...)} +by the order they are parsed. This is useful for keeping the parameter +order the same when using 2 different ODE models. These are specified +by \code{param(par1, par2,...)} \item \strong{Variable interpolation statements}, which tells the interpolation -for specific covariates. These include \code{locf(cov1, cov2, ...)} for -last observation carried forward, \code{nocb(cov1, cov2, ...)} for next -observation carried backward, \code{linear(cov1, cov2, ...)} for linear -interpolation and \code{midpoint(cov1, cov2, ...)} for midpoint +for specific covariates. These include \code{locf(cov1, cov2, ...)} for +last observation carried forward, \code{nocb(cov1, cov2, ...)} for next +observation carried backward, \code{linear(cov1, cov2, ...)} for linear +interpolation and \code{midpoint(cov1, cov2, ...)} for midpoint interpolation. } @@ -411,8 +399,9 @@ An example model is shown below: Expressions in assignment and \code{if} statements can be numeric or logical. -Numeric expressions can include the following numeric operators \verb{+, -, *, /, ^} and those mathematical functions defined in the C or the R math -libraries (e.g., \code{fabs}, \code{exp}, \code{log}, \code{sin}, \code{abs}). +Numeric expressions can include the following numeric operators +\verb{+, -, *, /, ^} and those mathematical functions defined in the C or the +R math libraries (e.g., \code{fabs}, \code{exp}, \code{log}, \code{sin}, \code{abs}). You may also access the R’s functions in the \href{https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Numerical-analysis-subroutines}{R math libraries}, like \code{lgammafn} for the log gamma function. @@ -433,11 +422,9 @@ pharmacokinetics model). \code{podo} (oral dose, in the undocumented case of absorption transit models). \item Special constants like \code{pi} or \href{https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Mathematical-constants}{R’s predefined constants}. -\item Model parameters (e.g., \code{ka} rate of absorption, \code{CL} clearance, -etc.) -\item Others, as created by assignments as part of the model -specification; these are referred as \emph{LHS} (left-hand side) -variable. +\item Model parameters (e.g., \code{ka} rate of absorption, \code{CL} clearance, etc.) +\item Others, as created by assignments as part of the model specification; +these are referred as \emph{LHS} (left-hand side) variable. } Currently, the \code{rxode2} modeling language only recognizes system state @@ -745,7 +732,7 @@ y=f+(a+b* f^c)*err The second, \strong{combined2}, assumes that the additive and proportional differences are combined on a variance scale: -y=f+[sqrt(a^2+b^2 *f^(2c))]*err +y=f+$$sqrt(a^2+b^2 *f^(2c))$$*err The default in \code{nlmixr2}/\code{rxode2} if not otherwise specified is \strong{combined2} since it mirrors how adding 2 normal distributions in From ee9dddd250066c31dc9da31b39d73541755f88b9 Mon Sep 17 00:00:00 2001 From: Bill Denney Date: Thu, 24 Oct 2024 12:22:51 -0400 Subject: [PATCH 2/5] Fix documentation build --- NAMESPACE | 1 + R/et.R | 2 ++ man/rxEvid.Rd | 3 +++ 3 files changed, 6 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index 4ea9a31e7..2e5b9bf60 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -27,6 +27,7 @@ S3method("ini<-",default) S3method("model<-",default) S3method("rxode2<-","function") S3method("rxode2<-",default) +S3method("units<-",rxEvid) S3method(.DollarNames,rxEt) S3method(.DollarNames,rxSolve) S3method(.DollarNames,rxUi) diff --git a/R/et.R b/R/et.R index f8ee9af85..d4139e933 100644 --- a/R/et.R +++ b/R/et.R @@ -1376,6 +1376,8 @@ as.character.rxEvid <- function(x, ...) { as.rxEvid(NextMethod()) } +#' @rdname rxEvid +#' @export `units<-.rxEvid` <- function(x, value) { stop("'evid' is unitless", call. = FALSE) } diff --git a/man/rxEvid.Rd b/man/rxEvid.Rd index cbacbf7a3..81c0f433f 100644 --- a/man/rxEvid.Rd +++ b/man/rxEvid.Rd @@ -7,6 +7,7 @@ \alias{[.rxEvid} \alias{as.character.rxEvid} \alias{[[.rxEvid} +\alias{units<-.rxEvid} \alias{c.rxRateDur} \alias{format.rxEvid} \alias{format.rxRateDur} @@ -25,6 +26,8 @@ as.rxEvid(x) \method{[[}{rxEvid}(x, ...) +\method{units}{rxEvid}(x) <- value + \method{c}{rxRateDur}(x, ...) \method{format}{rxEvid}(x, ...) From fcadc42b860e00f5b949a65c05d88f93c797d42c Mon Sep 17 00:00:00 2001 From: Bill Denney Date: Thu, 24 Oct 2024 12:40:43 -0400 Subject: [PATCH 3/5] Categorize all functions for pkgdown --- R/assert.R | 1 + R/linMod.R | 3 +-- R/rudfui.R | 7 ++++++- _pkgdown.yml | 13 +++++++++++++ man/assertCompartmentExists.Rd | 1 + man/assertCompartmentName.Rd | 1 + man/assertCompartmentNew.Rd | 1 + man/assertRxUi.Rd | 1 + man/assertVariableExists.Rd | 1 + man/assertVariableNew.Rd | 1 + man/linMod.Rd | 10 ++++++++++ man/rxUdfUiData.Rd | 10 ++++++++++ man/rxUdfUiEst.Rd | 10 ++++++++++ man/rxUdfUiIniLhs.Rd | 10 ++++++++++ man/rxUdfUiMv.Rd | 10 ++++++++++ man/rxUdfUiNum.Rd | 11 ++++++++++- man/rxUdfUiParsing.Rd | 10 ++++++++++ man/testIniDf.Rd | 11 +++++++++++ man/testRxUnbounded.Rd | 3 ++- 19 files changed, 110 insertions(+), 5 deletions(-) diff --git a/R/assert.R b/R/assert.R index 8a51820d0..fef90bb5b 100644 --- a/R/assert.R +++ b/R/assert.R @@ -625,6 +625,7 @@ warnRxBounded <- function(ui, extra="", .var.name=.vname(ui)) { #' @return boolean, indicating if the object is a valid initialization data frame #' @export #' @author Matthew L. Fidler +#' @family Assertions #' @examples #' testIniDf(TRUE) testIniDf <- function(iniDf) { diff --git a/R/linMod.R b/R/linMod.R index d1266dc3d..9a62977dd 100644 --- a/R/linMod.R +++ b/R/linMod.R @@ -95,9 +95,8 @@ rxUdfUi.default <- function(fun) { #' `rxUdfUi()` for details. #' #' @export -#' +#' @family User functions #' @author Matthew L. Fidler -#' #' @examples #' #' linMod(x, 3) diff --git a/R/rudfui.R b/R/rudfui.R index 83df37f21..52b576a56 100644 --- a/R/rudfui.R +++ b/R/rudfui.R @@ -30,12 +30,12 @@ rxUdfUiReset() #' UI functions #' #' @return integer greater than 1L +#' @family User functions #' @export #' @author Matthew L. Fidler #' @examples #' #' rxUdfUiNum() -#' rxUdfUiNum <- function() { if (checkmate::testIntegerish(.udfUiEnv$num, lower=1L, len=1L, any.missing=FALSE)) { as.integer(.udfUiEnv$num) @@ -64,6 +64,7 @@ rxUdfUiIniDf <- function() { #' Return the lhs parsed language expression #' #' @return lhs language expression or NULL +#' @family User functions #' @export #' @author Matthew L. Fidler #' @examples @@ -87,6 +88,7 @@ rxUdfUiIniLhs <- function() { #' #' @return value of the `modelVariables` being processed or `NULL`. #' +#' @family User functions #' @export #' @author Matthew L. Fidler #' @examples @@ -113,6 +115,7 @@ rxUdfUiMv <- function(value) { #' @return value of the `data.frame` being processed or `NULL`. #' #' @export +#' @family User functions #' @author Matthew L. Fidler #' @examples #' @@ -135,6 +138,7 @@ rxUdfUiData <- function(value) { #' @param value when specified, this assigns the character value of #' the estimation method or NULL if there is nothing being estimated #' @return value of the estimation method being processed or NULL +#' @family User functions #' @export #' @author Matthew L. Fidler #' @examples @@ -156,6 +160,7 @@ rxUdfUiEst <- function(value) { #' Returns if the current ui function is being parsed #' #' @return logical if the current ui function is being parsed +#' @family User functions #' @export #' @author Matthew L. Fidler #' @examples diff --git a/_pkgdown.yml b/_pkgdown.yml index 838f424c9..a4b51a1d3 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -55,6 +55,7 @@ reference: - rxUiCompress - rxUiDecompress - rxode2<- + - testIniDf - testRxLinCmt - testRxUnbounded - update.rxUi @@ -160,6 +161,18 @@ reference: - rxSymInvChol - swapMatListWithCube - uppergamma +- title: User functions + contents: + - linMod + - rxIntToBase + - rxIntToLetter + - rxUdfUiData + - rxUdfUiEst + - rxUdfUiIniDf + - rxUdfUiIniLhs + - rxUdfUiMv + - rxUdfUiNum + - rxUdfUiParsing - title: Internal Functions contents: - .cbindOme diff --git a/man/assertCompartmentExists.Rd b/man/assertCompartmentExists.Rd index 2b570facb..3784cf354 100644 --- a/man/assertCompartmentExists.Rd +++ b/man/assertCompartmentExists.Rd @@ -33,6 +33,7 @@ Other Assertions: \code{\link{assertRxUi}()}, \code{\link{assertVariableExists}()}, \code{\link{assertVariableNew}()}, +\code{\link{testIniDf}()}, \code{\link{testRxUnbounded}()} } \author{ diff --git a/man/assertCompartmentName.Rd b/man/assertCompartmentName.Rd index d6e121f73..1ab647ffd 100644 --- a/man/assertCompartmentName.Rd +++ b/man/assertCompartmentName.Rd @@ -49,6 +49,7 @@ Other Assertions: \code{\link{assertRxUi}()}, \code{\link{assertVariableExists}()}, \code{\link{assertVariableNew}()}, +\code{\link{testIniDf}()}, \code{\link{testRxUnbounded}()} } \author{ diff --git a/man/assertCompartmentNew.Rd b/man/assertCompartmentNew.Rd index e62fa9703..47ceb0281 100644 --- a/man/assertCompartmentNew.Rd +++ b/man/assertCompartmentNew.Rd @@ -24,6 +24,7 @@ Other Assertions: \code{\link{assertRxUi}()}, \code{\link{assertVariableExists}()}, \code{\link{assertVariableNew}()}, +\code{\link{testIniDf}()}, \code{\link{testRxUnbounded}()} } \author{ diff --git a/man/assertRxUi.Rd b/man/assertRxUi.Rd index ee4d4e725..4dfdbdc86 100644 --- a/man/assertRxUi.Rd +++ b/man/assertRxUi.Rd @@ -103,6 +103,7 @@ Other Assertions: \code{\link{assertCompartmentNew}()}, \code{\link{assertVariableExists}()}, \code{\link{assertVariableNew}()}, +\code{\link{testIniDf}()}, \code{\link{testRxUnbounded}()} } \author{ diff --git a/man/assertVariableExists.Rd b/man/assertVariableExists.Rd index 2f657e098..7cad9157b 100644 --- a/man/assertVariableExists.Rd +++ b/man/assertVariableExists.Rd @@ -35,6 +35,7 @@ Other Assertions: \code{\link{assertCompartmentNew}()}, \code{\link{assertRxUi}()}, \code{\link{assertVariableNew}()}, +\code{\link{testIniDf}()}, \code{\link{testRxUnbounded}()} } \author{ diff --git a/man/assertVariableNew.Rd b/man/assertVariableNew.Rd index b596b60e5..d11298b97 100644 --- a/man/assertVariableNew.Rd +++ b/man/assertVariableNew.Rd @@ -24,6 +24,7 @@ Other Assertions: \code{\link{assertCompartmentNew}()}, \code{\link{assertRxUi}()}, \code{\link{assertVariableExists}()}, +\code{\link{testIniDf}()}, \code{\link{testRxUnbounded}()} } \author{ diff --git a/man/linMod.Rd b/man/linMod.Rd index e3242238f..1b72580dd 100644 --- a/man/linMod.Rd +++ b/man/linMod.Rd @@ -102,6 +102,16 @@ Linear model to replace in rxode2 ui model linMod(x, 3) } +\seealso{ +Other User functions: +\code{\link{rxUdfUiData}()}, +\code{\link{rxUdfUiEst}()}, +\code{\link{rxUdfUiIniLhs}()}, +\code{\link{rxUdfUiMv}()}, +\code{\link{rxUdfUiNum}()}, +\code{\link{rxUdfUiParsing}()} +} \author{ Matthew L. Fidler } +\concept{User functions} diff --git a/man/rxUdfUiData.Rd b/man/rxUdfUiData.Rd index c43dd2cc2..284d5369f 100644 --- a/man/rxUdfUiData.Rd +++ b/man/rxUdfUiData.Rd @@ -19,7 +19,17 @@ Return the data.frame that is being processed or setup data.frame for processing rxUdfUiData() +} +\seealso{ +Other User functions: +\code{\link{linMod}()}, +\code{\link{rxUdfUiEst}()}, +\code{\link{rxUdfUiIniLhs}()}, +\code{\link{rxUdfUiMv}()}, +\code{\link{rxUdfUiNum}()}, +\code{\link{rxUdfUiParsing}()} } \author{ Matthew L. Fidler } +\concept{User functions} diff --git a/man/rxUdfUiEst.Rd b/man/rxUdfUiEst.Rd index c06b705cc..fbcde6a43 100644 --- a/man/rxUdfUiEst.Rd +++ b/man/rxUdfUiEst.Rd @@ -20,7 +20,17 @@ Return the current estimation method for the UI processing rxUdfUiEst() +} +\seealso{ +Other User functions: +\code{\link{linMod}()}, +\code{\link{rxUdfUiData}()}, +\code{\link{rxUdfUiIniLhs}()}, +\code{\link{rxUdfUiMv}()}, +\code{\link{rxUdfUiNum}()}, +\code{\link{rxUdfUiParsing}()} } \author{ Matthew L. Fidler } +\concept{User functions} diff --git a/man/rxUdfUiIniLhs.Rd b/man/rxUdfUiIniLhs.Rd index 2c45a4d41..1b65b69f5 100644 --- a/man/rxUdfUiIniLhs.Rd +++ b/man/rxUdfUiIniLhs.Rd @@ -16,7 +16,17 @@ Return the lhs parsed language expression rxUdfUiIniLhs() +} +\seealso{ +Other User functions: +\code{\link{linMod}()}, +\code{\link{rxUdfUiData}()}, +\code{\link{rxUdfUiEst}()}, +\code{\link{rxUdfUiMv}()}, +\code{\link{rxUdfUiNum}()}, +\code{\link{rxUdfUiParsing}()} } \author{ Matthew L. Fidler } +\concept{User functions} diff --git a/man/rxUdfUiMv.Rd b/man/rxUdfUiMv.Rd index d6c9989c1..588f79148 100644 --- a/man/rxUdfUiMv.Rd +++ b/man/rxUdfUiMv.Rd @@ -22,7 +22,17 @@ variables for processing rxUdfUiMv() +} +\seealso{ +Other User functions: +\code{\link{linMod}()}, +\code{\link{rxUdfUiData}()}, +\code{\link{rxUdfUiEst}()}, +\code{\link{rxUdfUiIniLhs}()}, +\code{\link{rxUdfUiNum}()}, +\code{\link{rxUdfUiParsing}()} } \author{ Matthew L. Fidler } +\concept{User functions} diff --git a/man/rxUdfUiNum.Rd b/man/rxUdfUiNum.Rd index ad161016a..07a5f5e48 100644 --- a/man/rxUdfUiNum.Rd +++ b/man/rxUdfUiNum.Rd @@ -17,8 +17,17 @@ UI functions \examples{ rxUdfUiNum() - +} +\seealso{ +Other User functions: +\code{\link{linMod}()}, +\code{\link{rxUdfUiData}()}, +\code{\link{rxUdfUiEst}()}, +\code{\link{rxUdfUiIniLhs}()}, +\code{\link{rxUdfUiMv}()}, +\code{\link{rxUdfUiParsing}()} } \author{ Matthew L. Fidler } +\concept{User functions} diff --git a/man/rxUdfUiParsing.Rd b/man/rxUdfUiParsing.Rd index 53ecb6949..eab3e5877 100644 --- a/man/rxUdfUiParsing.Rd +++ b/man/rxUdfUiParsing.Rd @@ -15,6 +15,16 @@ Returns if the current ui function is being parsed \examples{ rxUdfUiParsing() } +\seealso{ +Other User functions: +\code{\link{linMod}()}, +\code{\link{rxUdfUiData}()}, +\code{\link{rxUdfUiEst}()}, +\code{\link{rxUdfUiIniLhs}()}, +\code{\link{rxUdfUiMv}()}, +\code{\link{rxUdfUiNum}()} +} \author{ Matthew L. Fidler } +\concept{User functions} diff --git a/man/testIniDf.Rd b/man/testIniDf.Rd index aa0713a4b..a82d79451 100644 --- a/man/testIniDf.Rd +++ b/man/testIniDf.Rd @@ -36,6 +36,17 @@ This function tests if this object is a iniDf as needed by the UI \examples{ testIniDf(TRUE) } +\seealso{ +Other Assertions: +\code{\link{assertCompartmentExists}()}, +\code{\link{assertCompartmentName}()}, +\code{\link{assertCompartmentNew}()}, +\code{\link{assertRxUi}()}, +\code{\link{assertVariableExists}()}, +\code{\link{assertVariableNew}()}, +\code{\link{testRxUnbounded}()} +} \author{ Matthew L. Fidler } +\concept{Assertions} diff --git a/man/testRxUnbounded.Rd b/man/testRxUnbounded.Rd index bf914828f..21b013508 100644 --- a/man/testRxUnbounded.Rd +++ b/man/testRxUnbounded.Rd @@ -65,7 +65,8 @@ Other Assertions: \code{\link{assertCompartmentNew}()}, \code{\link{assertRxUi}()}, \code{\link{assertVariableExists}()}, -\code{\link{assertVariableNew}()} +\code{\link{assertVariableNew}()}, +\code{\link{testIniDf}()} } \author{ Matthew L. Fidler From b5db501539a9098f943266f5c04072d705bbbcfd Mon Sep 17 00:00:00 2001 From: Bill Denney Date: Thu, 24 Oct 2024 13:53:35 -0400 Subject: [PATCH 4/5] Fix package check issues --- R/et.R | 2 +- R/linMod.R | 11 +++++++---- man/rxEvid.Rd | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/R/et.R b/R/et.R index d4139e933..f552a4a22 100644 --- a/R/et.R +++ b/R/et.R @@ -1377,12 +1377,12 @@ as.character.rxEvid <- function(x, ...) { } #' @rdname rxEvid +#' @param value It will be an error to set units for evid #' @export `units<-.rxEvid` <- function(x, value) { stop("'evid' is unitless", call. = FALSE) } - #' @export `[<-.rxEvid` <- function(x, i, value) { as.rxEvid(NextMethod()) diff --git a/R/linMod.R b/R/linMod.R index 9a62977dd..ad0e1633b 100644 --- a/R/linMod.R +++ b/R/linMod.R @@ -238,10 +238,13 @@ linMod <- function(variable, power, dv="dv", warning(.dv, "not found in data, so no initial estimates will be set to zero") } else { names(.dat)[.wdv] <- .dv - .model <- stats::lm(as.formula(paste0(.dv, " ~ stats::poly(", .var, ",", - power, ")", - ifelse(intercept, "", "+0"))), - data=rxUdfUiData()) + .model <- + stats::lm( + stats::as.formula( + paste0(.dv, " ~ stats::poly(", .var, ",", power, ")", + ifelse(intercept, "", "+0"))), + data=rxUdfUiData() + ) .est <- coef(.model) } } diff --git a/man/rxEvid.Rd b/man/rxEvid.Rd index 81c0f433f..70e769f1d 100644 --- a/man/rxEvid.Rd +++ b/man/rxEvid.Rd @@ -40,6 +40,8 @@ as.rxEvid(x) \item{x}{Item to be converted to a rxode2 EVID specification.} \item{...}{Other parameters} + +\item{value}{It will be an error to set units for evid} } \value{ rxEvid specification From 8451d362788e48d984e6b586c235e86d03eca910 Mon Sep 17 00:00:00 2001 From: Matthew Fidler Date: Fri, 25 Oct 2024 12:46:17 -0500 Subject: [PATCH 5/5] To make with pkgdown for now don't run examples --- man-roxygen/etExamples.R | 26 ++++++++------ man/add.dosing.Rd | 26 ++++++++------ man/add.sampling.Rd | 26 ++++++++------ man/et.Rd | 26 ++++++++------ man/etRbind.Rd | 26 ++++++++------ man/etRep.Rd | 26 ++++++++------ man/etSeq.Rd | 26 ++++++++------ man/reexports.Rd | 1 + man/rxode2.Rd | 77 +++++++++++++++++++++++----------------- 9 files changed, 151 insertions(+), 109 deletions(-) diff --git a/man-roxygen/etExamples.R b/man-roxygen/etExamples.R index 664fa74d0..0fbca20b5 100644 --- a/man-roxygen/etExamples.R +++ b/man-roxygen/etExamples.R @@ -1,6 +1,6 @@ #' @examples #' -#' \donttest{ +#' \dontrun{ #' #' library(rxode2) #' library(units) @@ -32,16 +32,17 @@ #' ## These are making the more complex regimens of the rxode2 tutorial #' #' ## bid for 5 days -#' bid <- et(timeUnits="hr") %>% +#' bid <- et(timeUnits="hr") |> #' et(amt=10000,ii=12,until=set_units(5, "days")) #' #' ## qd for 5 days -#' qd <- et(timeUnits="hr") %>% +#' qd <- et(timeUnits="hr") |> #' et(amt=20000,ii=24,until=set_units(5, "days")) #' #' ## bid for 5 days followed by qd for 5 days #' -#' et <- seq(bid,qd) %>% et(seq(0,11*24,length.out=100)) +#' et <- seq(bid,qd) |> +#' et(seq(0,11*24,length.out=100)) #' #' bidQd <- rxSolve(mod1, et) #' @@ -51,11 +52,12 @@ #' ## Now Infusion for 5 days followed by oral for 5 days #' #' ## note you can dose to a named compartment instead of using the compartment number -#' infusion <- et(timeUnits = "hr") %>% +#' infusion <- et(timeUnits = "hr") |> #' et(amt=10000, rate=5000, ii=24, until=set_units(5, "days"), cmt="centr") #' #' -#' qd <- et(timeUnits = "hr") %>% et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") +#' qd <- et(timeUnits = "hr") |> +#' et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") #' #' et <- seq(infusion,qd) #' @@ -65,9 +67,10 @@ #' #' ## 2wk-on, 1wk-off #' -#' qd <- et(timeUnits = "hr") %>% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +#' qd <- et(timeUnits = "hr") |> +#' et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") #' -#' et <- seq(qd, set_units(1,"weeks"), qd) %>% +#' et <- seq(qd, set_units(1,"weeks"), qd) |> #' add.sampling(set_units(seq(0, 5.5,by=0.005),weeks)) #' #' wkOnOff <- rxSolve(mod1, et) @@ -76,10 +79,11 @@ #' #' ## You can also repeat the cycle easily with the rep function #' -#' qd <-et(timeUnits = "hr") %>% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +#' qd <-et(timeUnits = "hr") |> +#' et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") #' -#' et <- etRep(qd, times=4, wait=set_units(1,"weeks")) %>% -#' add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) +#' et <- etRep(qd, times=4, wait=set_units(1,"weeks")) |> +#' add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) #' #' repCycle4 <- rxSolve(mod1, et) #' diff --git a/man/add.dosing.Rd b/man/add.dosing.Rd index 8974a6cb3..1f08bf4c9 100644 --- a/man/add.dosing.Rd +++ b/man/add.dosing.Rd @@ -60,7 +60,7 @@ piping syntax through magrittr. It can also be accessed by \code{eventTable$add } \examples{ -\donttest{ +\dontrun{ library(rxode2) library(units) @@ -92,16 +92,17 @@ mod1 <-function(){ ## These are making the more complex regimens of the rxode2 tutorial ## bid for 5 days -bid <- et(timeUnits="hr") \%>\% +bid <- et(timeUnits="hr") |> et(amt=10000,ii=12,until=set_units(5, "days")) ## qd for 5 days -qd <- et(timeUnits="hr") \%>\% +qd <- et(timeUnits="hr") |> et(amt=20000,ii=24,until=set_units(5, "days")) ## bid for 5 days followed by qd for 5 days -et <- seq(bid,qd) \%>\% et(seq(0,11*24,length.out=100)) +et <- seq(bid,qd) |> + et(seq(0,11*24,length.out=100)) bidQd <- rxSolve(mod1, et) @@ -111,11 +112,12 @@ plot(bidQd, C2) ## Now Infusion for 5 days followed by oral for 5 days ## note you can dose to a named compartment instead of using the compartment number -infusion <- et(timeUnits = "hr") \%>\% +infusion <- et(timeUnits = "hr") |> et(amt=10000, rate=5000, ii=24, until=set_units(5, "days"), cmt="centr") -qd <- et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") +qd <- et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") et <- seq(infusion,qd) @@ -125,9 +127,10 @@ plot(infusionQd, C2) ## 2wk-on, 1wk-off -qd <- et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +qd <- et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") -et <- seq(qd, set_units(1,"weeks"), qd) \%>\% +et <- seq(qd, set_units(1,"weeks"), qd) |> add.sampling(set_units(seq(0, 5.5,by=0.005),weeks)) wkOnOff <- rxSolve(mod1, et) @@ -136,10 +139,11 @@ plot(wkOnOff, C2) ## You can also repeat the cycle easily with the rep function -qd <-et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +qd <-et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") -et <- etRep(qd, times=4, wait=set_units(1,"weeks")) \%>\% - add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) +et <- etRep(qd, times=4, wait=set_units(1,"weeks")) |> + add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) repCycle4 <- rxSolve(mod1, et) diff --git a/man/add.sampling.Rd b/man/add.sampling.Rd index 7b22b946b..05f352cd8 100644 --- a/man/add.sampling.Rd +++ b/man/add.sampling.Rd @@ -26,7 +26,7 @@ piping syntax through magrittr. It can also be accessed by } \examples{ -\donttest{ +\dontrun{ library(rxode2) library(units) @@ -58,16 +58,17 @@ mod1 <-function(){ ## These are making the more complex regimens of the rxode2 tutorial ## bid for 5 days -bid <- et(timeUnits="hr") \%>\% +bid <- et(timeUnits="hr") |> et(amt=10000,ii=12,until=set_units(5, "days")) ## qd for 5 days -qd <- et(timeUnits="hr") \%>\% +qd <- et(timeUnits="hr") |> et(amt=20000,ii=24,until=set_units(5, "days")) ## bid for 5 days followed by qd for 5 days -et <- seq(bid,qd) \%>\% et(seq(0,11*24,length.out=100)) +et <- seq(bid,qd) |> + et(seq(0,11*24,length.out=100)) bidQd <- rxSolve(mod1, et) @@ -77,11 +78,12 @@ plot(bidQd, C2) ## Now Infusion for 5 days followed by oral for 5 days ## note you can dose to a named compartment instead of using the compartment number -infusion <- et(timeUnits = "hr") \%>\% +infusion <- et(timeUnits = "hr") |> et(amt=10000, rate=5000, ii=24, until=set_units(5, "days"), cmt="centr") -qd <- et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") +qd <- et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") et <- seq(infusion,qd) @@ -91,9 +93,10 @@ plot(infusionQd, C2) ## 2wk-on, 1wk-off -qd <- et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +qd <- et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") -et <- seq(qd, set_units(1,"weeks"), qd) \%>\% +et <- seq(qd, set_units(1,"weeks"), qd) |> add.sampling(set_units(seq(0, 5.5,by=0.005),weeks)) wkOnOff <- rxSolve(mod1, et) @@ -102,10 +105,11 @@ plot(wkOnOff, C2) ## You can also repeat the cycle easily with the rep function -qd <-et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +qd <-et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") -et <- etRep(qd, times=4, wait=set_units(1,"weeks")) \%>\% - add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) +et <- etRep(qd, times=4, wait=set_units(1,"weeks")) |> + add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) repCycle4 <- rxSolve(mod1, et) diff --git a/man/et.Rd b/man/et.Rd index 23c024ccb..558324ac1 100644 --- a/man/et.Rd +++ b/man/et.Rd @@ -163,7 +163,7 @@ Event Table Function } \examples{ -\donttest{ +\dontrun{ library(rxode2) library(units) @@ -195,16 +195,17 @@ mod1 <-function(){ ## These are making the more complex regimens of the rxode2 tutorial ## bid for 5 days -bid <- et(timeUnits="hr") \%>\% +bid <- et(timeUnits="hr") |> et(amt=10000,ii=12,until=set_units(5, "days")) ## qd for 5 days -qd <- et(timeUnits="hr") \%>\% +qd <- et(timeUnits="hr") |> et(amt=20000,ii=24,until=set_units(5, "days")) ## bid for 5 days followed by qd for 5 days -et <- seq(bid,qd) \%>\% et(seq(0,11*24,length.out=100)) +et <- seq(bid,qd) |> + et(seq(0,11*24,length.out=100)) bidQd <- rxSolve(mod1, et) @@ -214,11 +215,12 @@ plot(bidQd, C2) ## Now Infusion for 5 days followed by oral for 5 days ## note you can dose to a named compartment instead of using the compartment number -infusion <- et(timeUnits = "hr") \%>\% +infusion <- et(timeUnits = "hr") |> et(amt=10000, rate=5000, ii=24, until=set_units(5, "days"), cmt="centr") -qd <- et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") +qd <- et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") et <- seq(infusion,qd) @@ -228,9 +230,10 @@ plot(infusionQd, C2) ## 2wk-on, 1wk-off -qd <- et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +qd <- et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") -et <- seq(qd, set_units(1,"weeks"), qd) \%>\% +et <- seq(qd, set_units(1,"weeks"), qd) |> add.sampling(set_units(seq(0, 5.5,by=0.005),weeks)) wkOnOff <- rxSolve(mod1, et) @@ -239,10 +242,11 @@ plot(wkOnOff, C2) ## You can also repeat the cycle easily with the rep function -qd <-et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +qd <-et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") -et <- etRep(qd, times=4, wait=set_units(1,"weeks")) \%>\% - add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) +et <- etRep(qd, times=4, wait=set_units(1,"weeks")) |> + add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) repCycle4 <- rxSolve(mod1, et) diff --git a/man/etRbind.Rd b/man/etRbind.Rd index 5cc5e28ec..7b6389103 100644 --- a/man/etRbind.Rd +++ b/man/etRbind.Rd @@ -59,7 +59,7 @@ Combining event tables } \examples{ -\donttest{ +\dontrun{ library(rxode2) library(units) @@ -91,16 +91,17 @@ mod1 <-function(){ ## These are making the more complex regimens of the rxode2 tutorial ## bid for 5 days -bid <- et(timeUnits="hr") \%>\% +bid <- et(timeUnits="hr") |> et(amt=10000,ii=12,until=set_units(5, "days")) ## qd for 5 days -qd <- et(timeUnits="hr") \%>\% +qd <- et(timeUnits="hr") |> et(amt=20000,ii=24,until=set_units(5, "days")) ## bid for 5 days followed by qd for 5 days -et <- seq(bid,qd) \%>\% et(seq(0,11*24,length.out=100)) +et <- seq(bid,qd) |> + et(seq(0,11*24,length.out=100)) bidQd <- rxSolve(mod1, et) @@ -110,11 +111,12 @@ plot(bidQd, C2) ## Now Infusion for 5 days followed by oral for 5 days ## note you can dose to a named compartment instead of using the compartment number -infusion <- et(timeUnits = "hr") \%>\% +infusion <- et(timeUnits = "hr") |> et(amt=10000, rate=5000, ii=24, until=set_units(5, "days"), cmt="centr") -qd <- et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") +qd <- et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") et <- seq(infusion,qd) @@ -124,9 +126,10 @@ plot(infusionQd, C2) ## 2wk-on, 1wk-off -qd <- et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +qd <- et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") -et <- seq(qd, set_units(1,"weeks"), qd) \%>\% +et <- seq(qd, set_units(1,"weeks"), qd) |> add.sampling(set_units(seq(0, 5.5,by=0.005),weeks)) wkOnOff <- rxSolve(mod1, et) @@ -135,10 +138,11 @@ plot(wkOnOff, C2) ## You can also repeat the cycle easily with the rep function -qd <-et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +qd <-et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") -et <- etRep(qd, times=4, wait=set_units(1,"weeks")) \%>\% - add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) +et <- etRep(qd, times=4, wait=set_units(1,"weeks")) |> + add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) repCycle4 <- rxSolve(mod1, et) diff --git a/man/etRep.Rd b/man/etRep.Rd index f4401c1ff..a850e88e0 100644 --- a/man/etRep.Rd +++ b/man/etRep.Rd @@ -77,7 +77,7 @@ Repeat an rxode2 event table } \examples{ -\donttest{ +\dontrun{ library(rxode2) library(units) @@ -109,16 +109,17 @@ mod1 <-function(){ ## These are making the more complex regimens of the rxode2 tutorial ## bid for 5 days -bid <- et(timeUnits="hr") \%>\% +bid <- et(timeUnits="hr") |> et(amt=10000,ii=12,until=set_units(5, "days")) ## qd for 5 days -qd <- et(timeUnits="hr") \%>\% +qd <- et(timeUnits="hr") |> et(amt=20000,ii=24,until=set_units(5, "days")) ## bid for 5 days followed by qd for 5 days -et <- seq(bid,qd) \%>\% et(seq(0,11*24,length.out=100)) +et <- seq(bid,qd) |> + et(seq(0,11*24,length.out=100)) bidQd <- rxSolve(mod1, et) @@ -128,11 +129,12 @@ plot(bidQd, C2) ## Now Infusion for 5 days followed by oral for 5 days ## note you can dose to a named compartment instead of using the compartment number -infusion <- et(timeUnits = "hr") \%>\% +infusion <- et(timeUnits = "hr") |> et(amt=10000, rate=5000, ii=24, until=set_units(5, "days"), cmt="centr") -qd <- et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") +qd <- et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") et <- seq(infusion,qd) @@ -142,9 +144,10 @@ plot(infusionQd, C2) ## 2wk-on, 1wk-off -qd <- et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +qd <- et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") -et <- seq(qd, set_units(1,"weeks"), qd) \%>\% +et <- seq(qd, set_units(1,"weeks"), qd) |> add.sampling(set_units(seq(0, 5.5,by=0.005),weeks)) wkOnOff <- rxSolve(mod1, et) @@ -153,10 +156,11 @@ plot(wkOnOff, C2) ## You can also repeat the cycle easily with the rep function -qd <-et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +qd <-et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") -et <- etRep(qd, times=4, wait=set_units(1,"weeks")) \%>\% - add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) +et <- etRep(qd, times=4, wait=set_units(1,"weeks")) |> + add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) repCycle4 <- rxSolve(mod1, et) diff --git a/man/etSeq.Rd b/man/etSeq.Rd index 41720d95c..d92dc9b28 100644 --- a/man/etSeq.Rd +++ b/man/etSeq.Rd @@ -56,7 +56,7 @@ interval. } \examples{ -\donttest{ +\dontrun{ library(rxode2) library(units) @@ -88,16 +88,17 @@ mod1 <-function(){ ## These are making the more complex regimens of the rxode2 tutorial ## bid for 5 days -bid <- et(timeUnits="hr") \%>\% +bid <- et(timeUnits="hr") |> et(amt=10000,ii=12,until=set_units(5, "days")) ## qd for 5 days -qd <- et(timeUnits="hr") \%>\% +qd <- et(timeUnits="hr") |> et(amt=20000,ii=24,until=set_units(5, "days")) ## bid for 5 days followed by qd for 5 days -et <- seq(bid,qd) \%>\% et(seq(0,11*24,length.out=100)) +et <- seq(bid,qd) |> + et(seq(0,11*24,length.out=100)) bidQd <- rxSolve(mod1, et) @@ -107,11 +108,12 @@ plot(bidQd, C2) ## Now Infusion for 5 days followed by oral for 5 days ## note you can dose to a named compartment instead of using the compartment number -infusion <- et(timeUnits = "hr") \%>\% +infusion <- et(timeUnits = "hr") |> et(amt=10000, rate=5000, ii=24, until=set_units(5, "days"), cmt="centr") -qd <- et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") +qd <- et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(5, "days"), cmt="depot") et <- seq(infusion,qd) @@ -121,9 +123,10 @@ plot(infusionQd, C2) ## 2wk-on, 1wk-off -qd <- et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +qd <- et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") -et <- seq(qd, set_units(1,"weeks"), qd) \%>\% +et <- seq(qd, set_units(1,"weeks"), qd) |> add.sampling(set_units(seq(0, 5.5,by=0.005),weeks)) wkOnOff <- rxSolve(mod1, et) @@ -132,10 +135,11 @@ plot(wkOnOff, C2) ## You can also repeat the cycle easily with the rep function -qd <-et(timeUnits = "hr") \%>\% et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") +qd <-et(timeUnits = "hr") |> + et(amt=10000, ii=24, until=set_units(2, "weeks"), cmt="depot") -et <- etRep(qd, times=4, wait=set_units(1,"weeks")) \%>\% - add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) +et <- etRep(qd, times=4, wait=set_units(1,"weeks")) |> + add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) repCycle4 <- rxSolve(mod1, et) diff --git a/man/reexports.Rd b/man/reexports.Rd index 8cba3d62e..2857ff16d 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -38,3 +38,4 @@ below to see their documentation. \item{magrittr}{\code{\link[magrittr:pipe]{\%>\%}}} }} +\value{ Inherited from parent routine } diff --git a/man/rxode2.Rd b/man/rxode2.Rd index ec4f1d898..908b50cc3 100644 --- a/man/rxode2.Rd +++ b/man/rxode2.Rd @@ -218,7 +218,10 @@ drug-disease modeling, etc. The ODE-based model specification may be coded inside four places: \itemize{ \item Inside a \code{rxode2({})} block statements: -} +}\if{html}{\out{ + +}} + \if{html}{\out{
}}\preformatted{library(rxode2) mod <- rxode2(\{ @@ -231,7 +234,10 @@ mod <- rxode2(\{ }\if{html}{\out{
}} \itemize{ \item Inside a \code{rxode2("")} string statement: -} +}\if{html}{\out{ + +}} + \if{html}{\out{
}}\preformatted{mod <- rxode2(" # simple assignment @@ -243,7 +249,10 @@ mod <- rxode2(\{ }\if{html}{\out{
}} \itemize{ \item In a file name to be loaded by rxode2: -} +}\if{html}{\out{ + +}} + \if{html}{\out{
}}\preformatted{writeLines(" # simple assignment @@ -257,7 +266,10 @@ unlink("modelFile.rxode2") }\if{html}{\out{
}} \itemize{ \item In a model function which can be parsed by \code{rxode2}: -} +}\if{html}{\out{ + +}} + \if{html}{\out{
}}\preformatted{mod <- function() \{ model(\{ @@ -335,9 +347,9 @@ Assignment statements can be: \itemize{ \item \strong{simple} assignments, where the left hand is an identifier (i.e., variable). This includes string assignments -\item special \strong{time-derivative} assignments, where the left hand specifies -the change of the amount in the corresponding state variable -(compartment) with respect to time e.g., \code{d/dt(depot)}: +\item special \strong{time-derivative} assignments, where the left hand +specifies the change of the amount in the corresponding state +variable (compartment) with respect to time e.g., \code{d/dt(depot)}: \item special \strong{initial-condition} assignments where the left hand specifies the compartment of the initial condition being specified, e.g. \code{depot(0) = 0} @@ -346,20 +358,20 @@ e.g. \code{depot(0) = 0} (\code{rate(depot)=2}) and \strong{modeled duration} (\code{dur(depot)=2}). An example of these model features and the event specification for the modeled infusions the rxode2 data specification is found in \href{https://nlmixr2.github.io/rxode2/articles/rxode2-event-types.html}{rxode2 events vignette}. -\item special \strong{change point syntax, or model times}. These model times are -specified by \code{mtime(var)=time} +\item special \strong{change point syntax, or model times}. These model times +are specified by \code{mtime(var)=time} \item special \strong{Jacobian-derivative} assignments, where the left hand specifies the change in the compartment ode with respect to a variable. For example, if \code{d/dt(y) = dy}, then a Jacobian for this -compartment can be specified as \code{df(y)/dy(dy) = 1}. There may be some -advantage to obtaining the solution or specifying the Jacobian for -very stiff ODE systems. However, for the few stiff systems we tried -with LSODA, this actually slightly slowed down the solving. -\item Special \strong{string value declarations} which tell what values a string -variable will take within a \code{rxode2} solving structure. These values -will then cause a factor to be created for this variable on solving -the \code{rxode2} model. As such, they are declared in much the same way as -\code{R}, that is: \code{labels(a) <- c("a1", "a2")}. +compartment can be specified as \code{df(y)/dy(dy) = 1}. There may be +some advantage to obtaining the solution or specifying the Jacobian +for very stiff ODE systems. However, for the few stiff systems we +tried with LSODA, this actually slightly slowed down the solving. +\item Special \strong{string value declarations} which tell what values a +string variable will take within a \code{rxode2} solving structure. These +values will then cause a factor to be created for this variable on +solving the \code{rxode2} model. As such, they are declared in much the +same way as \code{R}, that is: \code{labels(a) <- c("a1", "a2")}. } Note that assignment can be done by \code{=}, \verb{<-} or \code{~}. @@ -377,14 +389,14 @@ add extra compartment names at the end (useful for multiple-endpoint nlmixr models); These are specified by \code{cmt(compartmentName)} \item \strong{Parameter declaration statements}, which can make sure the input parameters are in a certain order instead of ordering the parameters -by the order they are parsed. This is useful for keeping the parameter -order the same when using 2 different ODE models. These are specified -by \code{param(par1, par2,...)} +by the order they are parsed. This is useful for keeping the +parameter order the same when using 2 different ODE models. These +are specified by \code{param(par1, par2,...)} \item \strong{Variable interpolation statements}, which tells the interpolation -for specific covariates. These include \code{locf(cov1, cov2, ...)} for -last observation carried forward, \code{nocb(cov1, cov2, ...)} for next -observation carried backward, \code{linear(cov1, cov2, ...)} for linear -interpolation and \code{midpoint(cov1, cov2, ...)} for midpoint +for specific covariates. These include \code{locf(cov1, cov2, ...)} for +last observation carried forward, \code{nocb(cov1, cov2, ...)} for next +observation carried backward, \code{linear(cov1, cov2, ...)} for linear +interpolation and \code{midpoint(cov1, cov2, ...)} for midpoint interpolation. } @@ -399,9 +411,8 @@ An example model is shown below: Expressions in assignment and \code{if} statements can be numeric or logical. -Numeric expressions can include the following numeric operators -\verb{+, -, *, /, ^} and those mathematical functions defined in the C or the -R math libraries (e.g., \code{fabs}, \code{exp}, \code{log}, \code{sin}, \code{abs}). +Numeric expressions can include the following numeric operators \verb{+, -, *, /, ^} and those mathematical functions defined in the C or the R math +libraries (e.g., \code{fabs}, \code{exp}, \code{log}, \code{sin}, \code{abs}). You may also access the R’s functions in the \href{https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Numerical-analysis-subroutines}{R math libraries}, like \code{lgammafn} for the log gamma function. @@ -422,9 +433,11 @@ pharmacokinetics model). \code{podo} (oral dose, in the undocumented case of absorption transit models). \item Special constants like \code{pi} or \href{https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Mathematical-constants}{R’s predefined constants}. -\item Model parameters (e.g., \code{ka} rate of absorption, \code{CL} clearance, etc.) -\item Others, as created by assignments as part of the model specification; -these are referred as \emph{LHS} (left-hand side) variable. +\item Model parameters (e.g., \code{ka} rate of absorption, \code{CL} clearance, +etc.) +\item Others, as created by assignments as part of the model +specification; these are referred as \emph{LHS} (left-hand side) +variable. } Currently, the \code{rxode2} modeling language only recognizes system state @@ -732,7 +745,7 @@ y=f+(a+b* f^c)*err The second, \strong{combined2}, assumes that the additive and proportional differences are combined on a variance scale: -y=f+$$sqrt(a^2+b^2 *f^(2c))$$*err +y=f+[sqrt(a^2+b^2 *f^(2c))]*err The default in \code{nlmixr2}/\code{rxode2} if not otherwise specified is \strong{combined2} since it mirrors how adding 2 normal distributions in