[R] source("filename") vs. input from command-line

Prof Brian D Ripley ripley at stats.ox.ac.uk
Thu Apr 22 22:42:25 CEST 1999


On Thu, 22 Apr 1999, Alex Buerkle wrote:

> 
> On Wed, 21 Apr 1999, Alex Buerkle wrote:
> > When I source("tmp.r") a file from within R, the code executes without
> > error. When I launch with 'R --no-save --no-restore < tmp.r', the code
> > sometimes appears to cause some type of buffer overflow and nothing gets
> > executed.
> 
> BR> Version? OS?  On my R-0.64.0 on Solaris I can do this ...
> 
> I am using R-0.63.3 on linux-x86.
> 
> > It appears that when the vector is long, say 121 x 17 digits numbers, the
> > new line character is not recognized, because R prints a newline, but puts
> > the '+' continuation symbol on the next line, and does so for each
> > subsequent line, as follows ...
> 
> BR> The NL is only used to break up input: this is saying that what it
> BR> has seen so far is syntactically incomplete.  Is this a standard
> BR> Unix text file (if you are on Unix)?
> 
> It is a standard text file.  If it were syntactially incomplete, sourcing

That is not what I asked!

> it from the R prompt would fail, but it doesn't.

But the version read from the file is syntactically incomplete.... This
implies that something is going wrong in the read.

> I am still not clear on why the command-line redirection did not work
> (R --no-save --no-restore < tmp.r).  Is there a difference between how
> R handles input received from a unix pipe versus from redirection?

Not on my system, and as it does work for me on Solaris, the problem seems
to be specific to something in your version.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list