guiDo {plotAndPlayGTK} | R Documentation |
Execute a command, log it, and show error dialog on failure.
guiDo(expr, call, string, doLog = T, doFailureLog = doLog, logFunction = addToLog, doFailureDialog = T, doStop = T, envir = if (doLog) .GlobalEnv else parent.frame(), ...)
expr |
an expression to run (eval ) in the given environment.
To run multiple commands, wrap them in {braces}. |
call |
a call object. If given this is used instead of expr . |
string |
a string to parse and run. If given this is used instead of expr . |
doLog |
whether to write the command to a log: see logFunction . |
doFailureLog |
whether to log "# FAILED" if an error occurs. |
logFunction |
a function to write text to the log, passed as the first argument.
If the default addToLog is not defined then function(x) cat(x,"\n") is used. |
doFailureDialog |
Whether to show a dialog box if an error occurs. |
doStop |
Whether to stop execution if an error occurs.
If false, the function can return an object of class error : see tryCatch . |
envir |
environment to evaluate the command in. |
... |
further arguments passed to deparse . |
This is for use in a GUI based on RGtk2. It runs the given command (which can be given as a literal expression, a string to parse, or a call object) in the specified environment, writes the command to a log, and shows an error dialog on failure. The error dialog contains the given call, the frame where the error occurred, the error message, and a suggestion to send in a bug report.
guiDo
returns the result of the given call, or an object of class error
if there was an error and doStop=F
.
Felix Andrews felix@nfrac.org
## Not run: x <- "hello" guiDo(y <- paste(x, "world")) # error dialog: guiDo( print(paste(y + 1, "is not a number")) ) ## End(Not run)