[R] Very long console input lines

Spencer Graves spencer.graves at pdf.com
Wed Sep 17 18:45:30 CEST 2003


Have you considered enclosing the "very long string" in parentheses?  
Then R will know that it is not syntactically correct until it reaches 
the end.  To avoid that kind of thing, I routinely include "(" just to 
the right of "<-" in virtually any statement that might otherwise get 
split onto two lines in a way that the first might be evaluated without 
the second. 

hope this helps.  spencer graves
p.s.  I got this from Venables and Ripley, but I can't remember which 
book or which page. 

alessandro.valli at AMD.com wrote:

>Hallo all,
>
>I got a problem executing R in batch-mode via a perl-script (under Win2000) : 
>	system ("Rterm.exe --slave --no-save --no-restore \<Rfile.r \>NUL");
>The R execution is aborting with syntax error due to very-long lines.
>My solution is converting
>a <- c("very long string")
>to
>a <- paste("short string 1",\n
>                "short string 2",\n
>                      ...,\n
>                "short string n")
>It is not very elegant ...
>Does anybody know a better solution ?
>
>Thank you in advance,
>Alessandro Valli
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>  
>




More information about the R-help mailing list