[R] problem with for()

Simone Gabbriellini ogabbrie at tin.it
Wed Aug 3 23:24:21 CEST 2005


Dear list,
can someone tell me why this two pieces of code give me the same  
results?

 > for(i in 0:5){ sum[i] = i }
 > sum
[1] 1 2 3 4 5

 > for(i in 1:5){ sum[i] = i }
 > sum
[1] 1 2 3 4 5

shouldn't the first one be

0 1 2 3 4 5

thank you,
simone




More information about the R-help mailing list