Skip to content

Commit

Permalink
Address some of Johns questions with a single accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Jan 11, 2024
1 parent 7655742 commit 672446c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions R/rxUiGet.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,54 @@ rxUiGet.stateDf <- function(x, ...) {
}
attr(rxUiGet.stateDf, "desc") <- "states and cmt number data.frame"

#' @export
#' @rdname rxUiGet
rxUiGet.params <- function(x, ...) {
.x <- x[[1]]
.ini <- .x$iniDf
.w <- !is.na(.ini$ntheta) & is.na(.ini$err)
.pop <- .ini$name[.w]
.w <- !is.na(.ini$ntheta) & !is.na(.ini$err)
.resid <- .ini$name[.w]
.w <- !is.na(.ini$neta1)
.cnds <- unique(.ini$condition[.w])
.var <- lapply(.cnds,
function(cnd) {
.w <- which(.ini$condition == cnd &
.ini$neta1 == .ini$neta2)
.ini$name[.w]
})
.mv <- rxGetModel(.x)
.lin <- FALSE
.doseExtra <- character(0)
.mv <- rxModelVars(.x)
if (!is.null(.x$.linCmtM)) {
.lin <- TRUE
if (.mv$extraCmt == 2L) {
.doseExtra <- c("depot", "central")
} else if (.mv$extramt == 1L) {
.doseExtra <- "central"
}
}
.predDf <- .x$predDf
if (!.lin & any(.predDf$linCmt)) {
.lin <- TRUE
if (.mv$flags["ka"] == 1L) {
.doseExtra <- c("depot", "central")
} else {
.doseExtra <- "central"
}
}
.dose <- c(.doseExtra, .x$state)
names(.var) <- .cnds
list(pop=.pop,
resid=.resid,
group=.var,
linCmt=.lin,
cmt=.dose)
}
attr(rxUiGet.params, "desc") <- "Parameter names"

#' @export
#' @rdname rxUiGet
rxUiGet.theta <- function(x, ...) {
Expand Down

0 comments on commit 672446c

Please sign in to comment.