guiDo             package:plotAndPlayGTK             R Documentation

_W_r_a_p_p_e_r _f_o_r _r_u_n_n_i_n_g _c_o_m_m_a_n_d_s _f_r_o_m _a _G_U_I

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

    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'. 

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

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

_A_u_t_h_o_r(_s):

     Felix Andrews felix@nfrac.org

_E_x_a_m_p_l_e_s:

     ## Not run: 

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

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

     ## End(Not run)

