[R] Matrix set value problem

2008-07-03 Thread Valentino Botta
the following code: m-matrix(nrow=10,ncol=10) i-1001 mx-trunc(i/1000) my-(i/1000-mx)*1000 m[mx,my]-1 does not assign the value at the matrix m[1,1] Any hints? Thanks v -- View this message in context: http://www.nabble.com/Matrix-set-value-problem-tp18253809p18253809.html Sent from the R

Re: [R] Matrix set value problem

2008-07-03 Thread ONKELINX, Thierry
-project.org Onderwerp: [R] Matrix set value problem the following code: m-matrix(nrow=10,ncol=10) i-1001 mx-trunc(i/1000) my-(i/1000-mx)*1000 m[mx,my]-1 does not assign the value at the matrix m[1,1] Any hints? Thanks v -- View this message in context: http://www.nabble.com/Matrix-set-value

Re: [R] Matrix set value problem

2008-07-03 Thread ctu
Hi, when you do the trunc the mx is not a real integer 1 so you must round up m-matrix(data=NA, nrow=10,ncol=10) i-1001 mx-round(trunc(i/1000)) my-round((i/1000-mx)*1000) m[mx,my]-1 m [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]1 NA NA NA NA NA NA NA NA