Skip to content

Commit

Permalink
Merge pull request #807 from nlmixr2/rxUdfUiControl
Browse files Browse the repository at this point in the history
add rxUdfUiControl()
  • Loading branch information
mattfidler authored Nov 21, 2024
2 parents cfd5621 + de8878d commit 0525f56
Show file tree
Hide file tree
Showing 17 changed files with 84 additions and 6 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ export(rxTick)
export(rxToSE)
export(rxTrans)
export(rxUdfUi)
export(rxUdfUiControl)
export(rxUdfUiData)
export(rxUdfUiEst)
export(rxUdfUiIniDf)
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions R/err-foceiBase.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -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]]), ")")
Expand Down
30 changes: 30 additions & 0 deletions R/rudfui.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ reference:
- linMod
- rxIntToBase
- rxIntToLetter
- rxUdfUiControl
- rxUdfUiData
- rxUdfUiEst
- rxUdfUiIniDf
Expand Down
Binary file modified data/rxReservedKeywords.rda
Binary file not shown.
Binary file modified data/rxResidualError.rda
Binary file not shown.
Binary file modified data/rxSyntaxFunctions.rda
Binary file not shown.
1 change: 1 addition & 0 deletions man/linMod.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/reexports.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions man/rxUdfUiControl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/rxUdfUiData.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/rxUdfUiEst.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/rxUdfUiIniLhs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/rxUdfUiMv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/rxUdfUiNum.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/rxUdfUiParsing.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0525f56

Please sign in to comment.