[R] continuation lines in R script files

Evan Cooch cooch17 at verizon.net
Wed Sep 6 22:20:24 CEST 2006

When I have to enter a very large matrix into the R console, I can make 
use of the continuation feature in the console to enter the matrix in 
pieces (e.g.,  on a row by row basis). So, for example, the console 
would show the "+" sign for continuation lines - something like what 
I've written below:

+  0.05,0,0,
+ 0,0.1,0),
+ 3,3,byrow=T)

(obviously, for a matrix this small - 3x3 - I could enter it all on a 
single line, this is just to demonstrate)

My question is - how do you accomplish the same thing in an R script 
file? I've tried literally copying the preceding - syntax error at the 
second line. I've also tried


Again, syntax error, at the second line...

After multiple searches for 'continuation line', with no luck 
(everything I found refers to the R console, no a script file), I'll ask 
here. Basically, I want to know how to get an R script to handle a 
structure entered over multiple lines (e.g., a matrix). This is default 
behaviour in .m files in Matlab, and most other environments I've ever 
worked in (e.g., SAS looks for the ; to indicate end of a line).

Thanks in advance...

More information about the R-help mailing list