Skip to content

Commit

Permalink
PopED fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Oct 15, 2024
1 parent 036d3c6 commit fe17723
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

* Fix bug where `PopED` could error with certain `dvid` values

* Fix bug where if/else clauses in the model could cause the model to
not predict the values correctly.

# babelmixr2 0.1.4

* Added experimental `PopED` integration
Expand Down
5 changes: 4 additions & 1 deletion R/poped.R
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,10 @@ rxUiGet.popedRxmodelBase <- function(x, ...) {
logical(1), USE.NAMES = FALSE))
.mod <- .mod[.w]
.errDf <- .iniDf[!is.na(.iniDf$err), ,drop=FALSE]

# remove if/else so extra lhs statements are not hanging around
.mod <- str2lang(paste0("{", rxode2::.rxPrune(as.call(c(quote(`{`), .mod))), "}"))
.mod <- lapply(seq_along(.mod)[-1],
function(i) { .mod[[i]]})
.mod <- lapply(seq_along(.mod),
function(i) {
.cur <- .mod[[i]]
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-poped.R
Original file line number Diff line number Diff line change
Expand Up @@ -622,5 +622,6 @@ if (requireNamespace("PopED", quietly=TRUE)) {
p <- pheno()

expect_equal(eval(.popedRxModel(p))$lhs, c("rx_pred_", "rx_r_"))

})
}

0 comments on commit fe17723

Please sign in to comment.