Next: bcprd() Up: MacAnova Help File Previous: autoreg()   Contents


batch(fileName [,echo:T or F, prompt:string]), CHARACTER scalars
  fileName and string

Keywords: syntax, control, files
batch(FileName) executes the commands in the file with name given in the
quoted string or CHARACTER variable FileName.  It must be the last
command in a line or a compound command surrounded by '{' and '}' and
must not be in a loop.

In a version with windows (Macintosh, Windows, Motif), if FileName is ""
you will be prompted to enter the file name in a dialog box.

Lines of the file are read sequentially and executed as if they were
typed at the keyboard.  Normally, each line is printed with the file
name as prompt before it is executed.  You can suppress this by using
keyword phrase echo:F (see below), or by previously executing
setoptions(batchecho:F) (see topics setoptions() and 'options').

The batch file can contain any sequence of MacAnova commands.  This
includes additional batch() commands that do not read from a batch file
currently in use.

Here is an example of a short batch file designed to do cubic regression
of variable y on variable x and do a plot of residuals against x (see
also regress() and plot()):

   xsq <- x * x
   xcub <- x * xsq
   regress("y=x + xsq + xcub")
   plot(x, RESIDUALS, title:"Cubic regression residuals vs x")

When an error occurs, the default behavior is to terminate all current
batch() commands.  You can use setoptions(errors:N), where N is a
positive integer to increase the number of errors tolerated before
termination.  See topic 'options"errors"' for details.

batch(FileName,echo:F) works the same as batch(FileName) except the
prompts and lines read from the file are not printed.  This status is
inherited by batch files invoked from within a batch file.  You can use
setoptions(batchecho:F) to set the default behavior of batch() so that
lines will not be echoed.

batch(FileName,echo:T) forces the printing of prompts and commands, even
if option 'batchecho' has been set False (see subtopic

NOTE: If you want to suppress printing of both prompts and output, put
at the start of the file and
at the end of the file.  See subtopic 'options:"quiet"'.

batch(FileName,prompt:Prompt), where Prompt is a quoted string or
CHARACTER scalar, forces echoing, with command lines starting with
Prompt instead of the file name.  When the batch file contains a
setoptions(prompt:newPrompt) command, newPrompt overrides Prompt.  A
subsequent setoptions(default:T) in the file, restores Prompt.  See
topics setoptions(), 'options'.

On a Macintosh, selecting item Open Batch File on the File menu is the
same as typing 'batch("")' except that it first erases anything already
typed after the prompt.

See also topic 'launching'.

Gary Oehlert 2003-01-15