Re: [R] Selecting from matrix and then stacking in array.

2011-09-20 Thread Kristian Lind
Thank you. It works great. Kristian 2011/9/16 R. Michael Weylandt > I think changing nrow() to NROW() will get around that error. However, > this, as you can see, this goes a little astray at the end. Perhaps > something like this will work for you: > > z.ext <- rbind(z,array(0,c(9,3))) > z.out

Re: [R] Selecting from matrix and then stacking in array.

2011-09-16 Thread R. Michael Weylandt
I think changing nrow() to NROW() will get around that error. However, this, as you can see, this goes a little astray at the end. Perhaps something like this will work for you: z.ext <- rbind(z,array(0,c(9,3))) z.out <- array(0, c(3,3,9)) for(i in 1:9){ z.out[,,i] <- cbind(z.ext[c(i,i+3,i+6),

[R] Selecting from matrix and then stacking in array.

2011-09-14 Thread Kristian Lind
Hi, I'm solve a problem where I want to select every 3rd row from a matrix. I do this for all rows in a loop. This gives me "i" matrices with different number of rows I want to stack these matrices in an array and fill the blanks with zero. Does anyone have any suggestions on how to go about thi