[R] Lines in code

Duncan Murdoch murdoch at stats.uwo.ca
Fri Feb 5 13:52:31 CET 2010


On 05/02/2010 7:46 AM, Ronaldo Reis Júnior wrote:
> Hi,
> 
> I dont know if this a coding rule or a program bug.
> 
> When I write this function below it work:
> 
> a <- c(1,2)
> for(i in a){
>   print(i)
> }
> 
> [1] 1
> [1] 2
> 
> But if I write this function with line space it dont work.
> 
> a <- c(1,2)
> for(i in a){
> 
>   print(i)
> 
> }
> 
> Error: unexpected '}' in "}"
> 
> I remember that in early R version this limitation dont exist.
> 
> This is a bus, a rule or a missconfiguration on my linux system?
> 
> R version 2.10.1 (2009-12-14) on Debian Unstable
> 

When I try it it works:

 > a <- c(1,2)
 > for(i in a){
+
+   print(i)
+
+ }
[1] 1
[1] 2


so it is something local to your system or the way you entered the code.

Duncan Murdoch



More information about the R-help mailing list