Parses and then evaluates each expression in the given file.
By default, the evaluation is done in the global frame (frame 1).
USAGE:
source(file, local = F)
Splus < file
REQUIRED ARGUMENTS:
file:
character string giving the name of a file.
The entire contents of the file will be parsed and the resulting
expressions evaluated.
OPTIONAL ARGUMENTS:
local:
logical flag: if FALSE, the expressions on the file will be
evaluated in the top (global) frame; otherwise, locally to the function
calling source.
VALUE:
the value of the last expression on
the file (see eval).
Automatic printing of this result is turned off, if source is called at
the top level.
SIDE EFFECTS:
the working directory is changed if local=FALSE and assignments
are contained in the file.
Other side effects (such as plots) will be produced if present in the file.
DETAILS:
No assignments are committed until source exits normally;
this means that if S-PLUS encounters an error in the source file, no
assignments will be made.
In the Splus < file form,
each expression in the file is a top-level expression and assignments
are committed expression by expression.
Large source files are rather inefficient.
You may be able to write a function to do the same thing more efficiently.