Skip to contents

Parses NONMEM statements and attempts to apply them to a data frame in order to create a response variable

Usage

applyPredCode(
  df,
  pred,
  respCol = getEctdColName("Response"),
  report = TRUE,
  keepCols = respCol,
  verbose = getEctdVerbose()
)

parsePredCode(model, respCol = getEctdColName("Response"))

Arguments

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)

Value

A dataset with new columns added

Details

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

Author

Mike K Smith mstoolkit@googlemail.com

Examples

parsePredCode(c(
  "X = 1",
  "IF (X.EQ.1.OR.Y.GT.0) STUD = 1",
   "NEWVAR = THETA(1) + EXP(ETA(2))**LOG(EPS(1))"
))
#> Error in parsePredCode(c("X = 1", "IF (X.EQ.1.OR.Y.GT.0) STUD = 1", "NEWVAR = THETA(1) + EXP(ETA(2))**LOG(EPS(1))")): could not find function "parsePredCode"