[R] Very long console input lines

alessandro.valli@amd.com alessandro.valli at amd.com
Fri Sep 19 16:16:23 CEST 2003


Thank you Spencer,
but it seems not to work with strings :

myquery <- c("select ..... very long string 		=> gives syntax error
myquery <- {c("select ..... very long string		=> gives syntax error

It seems that the closing " is required in any case.

Thank you in any case,
Alessandro Valli


-----Original Message-----
From: Spencer Graves [mailto:spencer.graves at pdf.com]
Sent: Mittwoch, 17. September 2003 18:46
To: Valli, Alessandro
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Very long console input lines


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