Skip to content

Commit

Permalink
Add dplyr for equations too
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed May 28, 2024
1 parent 6814898 commit 393e3c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions R/covEq.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
.monolix2rx$odeType <- "nonStiff"
.Call(`_monolix2rx_trans_equation`, text, "<MODEL> [COVARIATE] EQUATION:")
.ret <- list(monolix=text,
rx=c(.monolix2rx$equationLine,
.monolix2rx$pk$equation$endLines),
dplyr=gsub("<-", "=",
c(.monolix2rx$equationLine,
.monolix2rx$pk$equation$endLines), fixed=TRUE),
odeType=.monolix2rx$odeType)
class(.ret) <- "monolix2rxCovEq"
.ret
Expand Down
7 changes: 7 additions & 0 deletions R/dataCov.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ mlxtranGetMutate <- function(mlxtran) {
}, character(1),
USE.NAMES=FALSE))
}
.cov <- mlxtran$MODEL$COVARIATE$EQUATION
if (!is.null(.cov)) {
.mutate <- c(.mutate,
paste0("dplyr::mutate(",
paste(.cov$dplyr, collapse=",\n\t\t"),
")"))
}
if (length(.mutate) == 0) return(NULL)
# Add equations
paste(.mutate, collapse=" |> \n\t")
Expand Down
1 change: 0 additions & 1 deletion R/dataImport.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
}
}
}
browser()
.mutate <- mlxtranGetMutate(mlxtran)
if (!is.null(.mutate)) {
.minfo("modifying input data to match monolix transformations")
Expand Down

0 comments on commit 393e3c9

Please sign in to comment.