Skip to content

Commit

Permalink
Merge pull request #697 from nlmixr2/696-$params-not-working-in-witho…
Browse files Browse the repository at this point in the history
…ut-ka

696 $params not working in without ka
  • Loading branch information
mattfidler authored Jun 24, 2024
2 parents ace2ece + 07bc1bd commit 56e8d74
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- Empty arguments to `rxRename()` give a warning (#688)
- Promoting from covariates to parameters with model piping (via `ini()`) now
allows setting bounds (#692)

## Bug fixes

- Fix `ui$params` when the ui is a linear compartment model without `ka` defined.

# rxode2 2.1.3

Expand Down
2 changes: 1 addition & 1 deletion R/rxUiGet.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ rxUiGet.params <- function(x, ...) {
.lin <- TRUE
if (.mv$extraCmt == 2L) {
.doseExtra <- c("depot", "central")
} else if (.mv$extramt == 1L) {
} else if (.mv$extraCmt == 1L) {
.doseExtra <- "central"
}
}
Expand Down
31 changes: 31 additions & 0 deletions tests/testthat/test-ui-param.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,35 @@ if (!.Call(`_rxode2_isIntel`)) {
state = character(0))))

})

test_that("linCmt single compartment parses correctly", {

mod <- function() {
ini({
cl <- 0.1
vc <- 4
err.sd <- 0.1
})
model({
Cc <- linCmt(cl, vc)
Cc ~ add(err.sd)
})
}

mod <- mod()

expect_error(mod$params, NA)

expect_equal(mod$params,
list(pop = c("cl", "vc"),
resid = "err.sd",
group = structure(list(), names = character(0)),
linCmt = TRUE,
cmt = "central",
output = list(primary = character(0),
secondary = character(0),
endpoint = "Cc",
state = character(0))))

})
}

0 comments on commit 56e8d74

Please sign in to comment.