Skip to content

Commit

Permalink
Add lotri expressions into function and add to news
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Nov 29, 2023
1 parent 2b0238b commit 7d902d7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ mu-referencing style to run the optimization.
`plot(ci, Cc)` which will only plot the variable `Cc` that you
summarized even if you also summarized `eff` (for instance).

- When the rxode2 ui is a compressed ui object, you can modify the ini
block with `$ini <-` or modify the model block with `$model <-`.
These are equivalent to `ini(model) <-` and `model(model) <-`,
respectively. Otherwise, the object is added to the user defined
components in the function (ie `$meta`). When the object is
uncompressed, it simply assigns it to the environment instead (just
like before).

- When printing meta information that happens to be a `lotri`
compatible matrix, use `lotri` to express it instead of the default
R expression.

## Internal new features

- Add `as.model()` for list expressions, which implies `model(ui) <-
Expand Down
17 changes: 16 additions & 1 deletion R/rxUiGet.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,22 @@ rxUiGet.funPrint <- function(x, ...) {
.ret <- vector("list", length(.ls) + ifelse(.hasIni, 3, 2))
.ret[[1]] <- quote(`{`)
for (.i in seq_along(.ls)) {
.ret[[.i + 1]] <- eval(parse(text=paste("quote(", .ls[.i], "<-", deparse1(.x$meta[[.ls[.i]]]), ")")))
.var <- .ls[.i]
.val <- .x$meta[[.ls[.i]]]
.isLotri <- FALSE
if (checkmate::checkMatrix(.val, any.missing=FALSE, row.names="strict", col.names="strict")) {
.dn <- dimnames(.val)
if (identical(.dn[[1]], .dn[[2]]) && isSymmetric(.val)) {
class(.val) <- c("lotriFix", class(.val))
.val <- as.expression(.val)
.val <- bquote(.(str2lang(.var)) <- .(.val))
.ret[[.i + 1]] <- .val
.isLotri <- TRUE
}
}
if (!.isLotri){
.ret[[.i + 1]] <- eval(parse(text=paste("quote(", .var, "<-", deparse1(.val), ")")))
}
}
.theta <- x$theta
.omega <- x$omega
Expand Down

0 comments on commit 7d902d7

Please sign in to comment.