applyPredCode | R Documentation |
Parses NONMEM statements and attempts to apply them to a data frame in order to create a response variable
applyPredCode(
df,
pred,
respCol = getEctdColName("Response"),
report = TRUE,
keepCols = respCol,
verbose = getEctdVerbose()
)
parsePredCode(model, respCol = getEctdColName("Response"))
df |
(Required) Data frame to which parsed NONMEM statements are to be applied |
pred |
Character vector of NONMEM statements |
respCol |
Response column name ( iven by getEctdColName by default) |
report |
Logical: should a textual report be produced? |
keepCols |
Character vector of column names to retain in the return dataset |
verbose |
Logical: Should verbose logging be used? ( given by getEctdVerbose by default) |
model |
File containing analysis code (for R or SAS) or an R function for analysis (R only) MSToolkit:::parsePredCode(c( "X = 1", "IF (X.EQ.1.OR.Y.GT.0) STUD = 1", "NEWVAR = THETA(1) + EXP(ETA(2))**LOG(EPS(1))" )) |
The applyPredCode
function calls the parsePredCode
function in
order to convert the NONMEM statements to executable R statements. The
applyPredCode
function then iteratively "tries" to apply these
statements to the data ("df"), producing a textual report of the process if
"report" is set to TRUE. The "keepCols" columns from the updated dataset
are then returned
A dataset with new columns added
Mike K Smith mstoolkit@googlemail.com
applyPredCode(
df = data.frame(X = 1:5, TH1 = rep(1, 5),
TH2 = rep(2, 5), ETA1 = rep(3, 5), EPS1 = rep(4, 5)),
pred = MSToolkit:::parsePredCode(c("TEST = 1","XCOPY = X","TH2COPY = THETA(2)",
"Y = XCOPY + LOG(THETA(1)) + THETA(2)**2 + ETA(1) + SQRT(EPS(1)) + 1")),
respCol ="RESP",
report = FALSE,
keepCols = c("TEST", "XCOPY", "TH2COPY", "RESP"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.