Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

696 $params not working in without ka #697

Merged
merged 5 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))))

})
}
Loading