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

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Apr 22 23:28:06 CEST 1999


Prof Brian D Ripley <ripley at stats.ox.ac.uk> writes:

> On Thu, 22 Apr 1999, Alex Buerkle wrote:
> 
> > 

> > > 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.

Hehe. You've been doing too little Perl hacking, Brian! When a Perl
hacker says that he has 121 17 digit numbers followed by a NL, he
means that he has *one* input line which is over 2k long...

I can reproduce the behaviour with an old pre-0.63.3, the new versions
have improved:

> x<-c(0.2540311, -0.6709876, -0.3677535, 0.5153803, 0.08444575, -0.6793758..
...-1.476418, -0.5809392, 0.48Error: syntax error
Execution halted

Well, kind of improved...

I'm not sure this is very easy to fix. R_ReadConsole deals in 1024
byte buffers in several places. The workaround should be obvious,
though.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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