[R] to raise in a loop more than 1

damien landais damien.landais at tdf.fr
Fri Jun 26 11:15:42 CEST 2009


I would raise x,y and z in a loop but I won't raise of 1. I tried this but it doesn't work

mydata=matrix(nrow=1500,ncol=3)
i=1
for(x in 0:10){
for(y in 0:20){
for(z in 0:10){
mydata[i,]=c(x,y,z)
i=i+1
z=z+2}
y=y+4}
x=x+2}

And I would have something like that 
x   y   z
0   0   0
0   0   2
0   0   4
0   0   6
0   0   8
0   0   10 
0   4   0
0   4   2
...

Could anybody help me?
I don't work on a special package to do it...

Thanks

Cordialement
Damien Landais




More information about the R-help mailing list