continuation lines in R script files
Are your sure your second solution does not work? Try again...
Evan Cooch wrote:
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: a=matrix(c(0,20,50, + 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). Thanks in advance...
______________________________________________ R-help at 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.
confidentiality notice:
The information contained in this e-mail is confidential and...{{dropped}}