source(file, local=F, echo=<<see below>>, n = -1, immediate = NULL)Splus < file
FALSE
,
the expressions will be evaluated in the top (global) frame;
otherwise, locally to the function calling
source
.
TRUE
, each expression will be printed, along with a prompt,
before it is evaluated.
The default is
TRUE
if
options(echo=T)
has been set and
length(recordConnection())==0
.
file
. If negative (the default),
parsing continues to the end of the file.
immediate
argument is provided for backward
compatibility only; it is no longer used.
eval
).
Automatic printing of this result is turned off, if
source
is called at
the top level.
local=FALSE
and assignments
are contained in the file.
Other side effects (such as plots) will be produced if present in the file.
Usually, 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.
If the last expression in the file given to
source
is a replacement
expression (e.g., x[1]<-1 or dim(x)[1]<-2) then
source
returns
no useful value.
postscript() # start a graphics device source("myplot") # source a file with tested plot commands