Quit From S-PLUS

DESCRIPTION:

Terminates the current S-PLUS session.

USAGE:

q(n=0) 

OPTIONAL ARGUMENTS:

n
integer value, to be used, modulo 256, as the exit status of the S-PLUS process. (In shell scripts, a non-zero exit status is conventionally an indication of an error.)

SIDE EFFECTS:

Causes termination of the S-PLUS session and returns to the operating system. If one or more graphics devices are active, a device-dependent wrap-up routine will be executed for each active device. The function or expression .Last, if it exists, will be called or evaluated before quitting.

DETAILS:

The q function is acceptable as an error option. This can be useful, for instance, by forcing BATCH jobs to quit on the first error.

Using an exclamation mark (!) as the first character of a command "escapes" the command to the operating system. Such escapes can, at times, be more efficient than quitting S-PLUS and then restarting it later.

BUGS:

When using the S-PLUS with the command line editor, Splus -e, the exit status is the exit status of the command line editor, not that of S-PLUS, so the argument to q cannot be used by the shell.

SEE ALSO:

for the function, , BATCH.

EXAMPLES:

  !vi foo   
# edit a file - when the editor is exited, control is returned to S-PLUS 
  q() # quit S-PLUS 
% echo $status 
0 
% Splus 
  options(error=expression({cat("Quitting at first error\n");q(123)})) 
  1///4 
Syntax error: */ ("/") used illegally at this point: 
1// 
Quitting at first error 
% echo $status 
123