From: Evan Cooch <cooch17_at_verizon.net>

Date: Wed 06 Sep 2006 - 20:20:24 GMT

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu Sep 07 06:22:01 2006

Date: Wed 06 Sep 2006 - 20:20:24 GMT

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

a=matrix(c(0,20,50,

0.05,0,0,

0,0.1,0),

3,3,byrow=T)

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

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu Sep 07 06:22:01 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Thu 07 Sep 2006 - 07:51:18 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*