diff --git a/NAMESPACE b/NAMESPACE index 2e5b9bf60..16a94c37a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -581,6 +581,7 @@ export(rxTick) export(rxToSE) export(rxTrans) export(rxUdfUi) +export(rxUdfUiControl) export(rxUdfUiData) export(rxUdfUiEst) export(rxUdfUiIniDf) diff --git a/NEWS.md b/NEWS.md index e5da1e343..eac8ccd00 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,9 @@ `babelmixr2` to better check what model is loaded and unload/reload as necessary. +- Add `rxUdfUiControl()` to rxode2 user function to get control + information from something like `nlmixr2` + # rxode2 3.0.2 - Bug fix for `api`, the censoring function pointer has been updated diff --git a/R/err-foceiBase.R b/R/err-foceiBase.R index 35eedb291..f33006cdd 100644 --- a/R/err-foceiBase.R +++ b/R/err-foceiBase.R @@ -323,14 +323,14 @@ #' Handle the single error for normal or t distributions #' #' @param env Environment for the parsed model -#' +#' #' @param pred1 The `data.frame` of the current error #' #' @param errNum The number of the error specification in the nlmixr2 model -#' +#' #' @param rxPredLlik A boolean indicating if the log likelihood should #' be calculated for non-normal distributions. By default `TRUE`. -#' +#' #' @return A list of the lines added. The lines will contain #' #' - `rx_yj_` which is an integer that corresponds to the @@ -347,7 +347,7 @@ #' - `rx_pred_` The transformed prediction function #' #' - `rx_r_` The transformed variance -#' +#' #' @author Matthew Fidler #' @export .handleSingleErrTypeNormOrTFoceiBase <- function(env, pred1, errNum=1L, rxPredLlik=TRUE) { @@ -474,7 +474,7 @@ .first <- vapply(seq(2, length(.c)), function(i) { paste0("(DV==",(i-1),")*(", deparse1(.c[[i]]),")") - + }, character(1), USE.NAMES=FALSE) .last <- vapply(seq(2, length(.c)), function(i) { paste0("(", deparse1(.c[[i]]), ")") diff --git a/R/rudfui.R b/R/rudfui.R index 52b576a56..c98580313 100644 --- a/R/rudfui.R +++ b/R/rudfui.R @@ -15,6 +15,7 @@ rxUdfUiReset <- function() { .udfUiEnv$lhs <- NULL .udfUiEnv$data <- NULL .udfUiEnv$est <- NULL + .udfUiEnv$control <- NULL .udfUiEnv$parsing <- FALSE .udfUiEnv$mv <- NULL invisible(NULL) @@ -133,6 +134,35 @@ rxUdfUiData <- function(value) { call.=FALSE) } } + +#' Return the control that is being processed or setup control for processing +#' +#' @param value when specified, this assigns the control to be +#' processed, or resets it by assigning it to be `NULL`. +#' +#' @return value of the `data.frame` being processed or `NULL`. +#' +#' @export +#' @family User functions +#' @author Matthew L. Fidler +#' @examples +#' +#' rxUdfUiControl() +#' +rxUdfUiControl <- function(value) { + if (missing(value)) { + .udfUiEnv$control + } else if (is.list(value)) { + .udfUiEnv$control <- value + } else if (is.null(value)) { + .udfUiEnv$control <- value + } else { + stop("rxUdfUiControl must be called with a list, NULL, or without any arguments", + call.=FALSE) + } + invisible(.udfUiEnv$control) + +} #' Return the current estimation method for the UI processing #' #' @param value when specified, this assigns the character value of diff --git a/data/rxReservedKeywords.rda b/data/rxReservedKeywords.rda index 55124a6cb..1ec5bb6b3 100644 Binary files a/data/rxReservedKeywords.rda and b/data/rxReservedKeywords.rda differ diff --git a/data/rxResidualError.rda b/data/rxResidualError.rda index d2c55b535..5a104fee5 100644 Binary files a/data/rxResidualError.rda and b/data/rxResidualError.rda differ diff --git a/data/rxSyntaxFunctions.rda b/data/rxSyntaxFunctions.rda index c320a5cf0..c88115476 100644 Binary files a/data/rxSyntaxFunctions.rda and b/data/rxSyntaxFunctions.rda differ diff --git a/man/linMod.Rd b/man/linMod.Rd index 1b72580dd..b3822e541 100644 --- a/man/linMod.Rd +++ b/man/linMod.Rd @@ -104,6 +104,7 @@ linMod(x, 3) } \seealso{ Other User functions: +\code{\link{rxUdfUiControl}()}, \code{\link{rxUdfUiData}()}, \code{\link{rxUdfUiEst}()}, \code{\link{rxUdfUiIniLhs}()}, 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/rxUdfUiControl.Rd b/man/rxUdfUiControl.Rd new file mode 100644 index 000000000..3f3f66d27 --- /dev/null +++ b/man/rxUdfUiControl.Rd @@ -0,0 +1,37 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/rudfui.R +\name{rxUdfUiControl} +\alias{rxUdfUiControl} +\title{Return the control that is being processed or setup control for processing} +\usage{ +rxUdfUiControl(value) +} +\arguments{ +\item{value}{when specified, this assigns the control to be +processed, or resets it by assigning it to be \code{NULL}.} +} +\value{ +value of the \code{data.frame} being processed or \code{NULL}. +} +\description{ +Return the control that is being processed or setup control for processing +} +\examples{ + +rxUdfUiControl() + +} +\seealso{ +Other User functions: +\code{\link{linMod}()}, +\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 284d5369f..948b32cd6 100644 --- a/man/rxUdfUiData.Rd +++ b/man/rxUdfUiData.Rd @@ -23,6 +23,7 @@ rxUdfUiData() \seealso{ Other User functions: \code{\link{linMod}()}, +\code{\link{rxUdfUiControl}()}, \code{\link{rxUdfUiEst}()}, \code{\link{rxUdfUiIniLhs}()}, \code{\link{rxUdfUiMv}()}, diff --git a/man/rxUdfUiEst.Rd b/man/rxUdfUiEst.Rd index fbcde6a43..032572926 100644 --- a/man/rxUdfUiEst.Rd +++ b/man/rxUdfUiEst.Rd @@ -24,6 +24,7 @@ rxUdfUiEst() \seealso{ Other User functions: \code{\link{linMod}()}, +\code{\link{rxUdfUiControl}()}, \code{\link{rxUdfUiData}()}, \code{\link{rxUdfUiIniLhs}()}, \code{\link{rxUdfUiMv}()}, diff --git a/man/rxUdfUiIniLhs.Rd b/man/rxUdfUiIniLhs.Rd index 1b65b69f5..3f8732cd9 100644 --- a/man/rxUdfUiIniLhs.Rd +++ b/man/rxUdfUiIniLhs.Rd @@ -20,6 +20,7 @@ rxUdfUiIniLhs() \seealso{ Other User functions: \code{\link{linMod}()}, +\code{\link{rxUdfUiControl}()}, \code{\link{rxUdfUiData}()}, \code{\link{rxUdfUiEst}()}, \code{\link{rxUdfUiMv}()}, diff --git a/man/rxUdfUiMv.Rd b/man/rxUdfUiMv.Rd index 588f79148..faf584456 100644 --- a/man/rxUdfUiMv.Rd +++ b/man/rxUdfUiMv.Rd @@ -26,6 +26,7 @@ rxUdfUiMv() \seealso{ Other User functions: \code{\link{linMod}()}, +\code{\link{rxUdfUiControl}()}, \code{\link{rxUdfUiData}()}, \code{\link{rxUdfUiEst}()}, \code{\link{rxUdfUiIniLhs}()}, diff --git a/man/rxUdfUiNum.Rd b/man/rxUdfUiNum.Rd index 07a5f5e48..74d5229f0 100644 --- a/man/rxUdfUiNum.Rd +++ b/man/rxUdfUiNum.Rd @@ -21,6 +21,7 @@ rxUdfUiNum() \seealso{ Other User functions: \code{\link{linMod}()}, +\code{\link{rxUdfUiControl}()}, \code{\link{rxUdfUiData}()}, \code{\link{rxUdfUiEst}()}, \code{\link{rxUdfUiIniLhs}()}, diff --git a/man/rxUdfUiParsing.Rd b/man/rxUdfUiParsing.Rd index eab3e5877..52a7055fe 100644 --- a/man/rxUdfUiParsing.Rd +++ b/man/rxUdfUiParsing.Rd @@ -18,6 +18,7 @@ rxUdfUiParsing() \seealso{ Other User functions: \code{\link{linMod}()}, +\code{\link{rxUdfUiControl}()}, \code{\link{rxUdfUiData}()}, \code{\link{rxUdfUiEst}()}, \code{\link{rxUdfUiIniLhs}()},