From 393e3c942b9562865a43a644578b853f61d6f224 Mon Sep 17 00:00:00 2001 From: "Matthew L. Fidler" Date: Mon, 27 May 2024 23:35:03 -0500 Subject: [PATCH] Add dplyr for equations too --- R/covEq.R | 5 +++-- R/dataCov.R | 7 +++++++ R/dataImport.R | 1 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/R/covEq.R b/R/covEq.R index 1caa8c8..b7eec84 100644 --- a/R/covEq.R +++ b/R/covEq.R @@ -9,8 +9,9 @@ .monolix2rx$odeType <- "nonStiff" .Call(`_monolix2rx_trans_equation`, text, " [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 diff --git a/R/dataCov.R b/R/dataCov.R index 1139dac..ab3a05d 100644 --- a/R/dataCov.R +++ b/R/dataCov.R @@ -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") diff --git a/R/dataImport.R b/R/dataImport.R index 4d84c3b..410eecf 100644 --- a/R/dataImport.R +++ b/R/dataImport.R @@ -22,7 +22,6 @@ } } } - browser() .mutate <- mlxtranGetMutate(mlxtran) if (!is.null(.mutate)) { .minfo("modifying input data to match monolix transformations")