guiDo {plotAndPlayGTK}R Documentation

Wrapper for running commands from a GUI

Description

Execute a command, log it, and show error dialog on failure.

Usage

guiDo(expr, call, string, doLog = T, doFailureLog = doLog, logFunction = addToLog, 
      doFailureDialog = T, doStop = T, envir = if (doLog) .GlobalEnv else parent.frame(),
      ...)

Arguments

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.

Details

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.

Value

guiDo returns the result of the given call, or an object of class error if there was an error and doStop=F.

Author(s)

Felix Andrews felix@nfrac.org

Examples

## Not run: 

x <- "hello"
guiDo(y <- paste(x, "world"))

# error dialog:
guiDo( print(paste(y + 1, "is not a number")) )

## End(Not run)

[Package plotAndPlayGTK version 0.8.78 Index]