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

Alex Buerkle cbuerkle at bio.indiana.edu
Thu Apr 22 01:21:44 CEST 1999


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

tmp.r contains:
myData<-c(1,0, ... long vector of numbers) followed by a new
line character and then some code to operate on myData.

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

... 0.673485477583901, 0.492934866805126, 0.67+ 97955088067,
0.359755098747052, 0.734365384276714, 0.776102576892879, 1)
+ Dmatrix <- matrix (mydata, byrow=TRUE, nrow=11, ncol=11 )
+ result<-eigen(Dmatrix)
+ varEig<-var(result$values)
+ cat (c('variance of the eigenvalues:', varEig), fill=TRUE)
When the list is shorter, I don't get this problem.

Anyone have any ideas as to what is going on?  The reason I am doing this
is to call R from a PERL program.  

Thanks, Alex

C. Alex Buerkle                 Ph:  812-855-9018
Jordan Hall 142                 Fax: 812-855-6705
Department of Biology           
Indiana University
Bloomington, IN 47405    cbuerkle at bio.indiana.edu

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