[R] to creates an array

Jim Lemon
Fri, 03 Jul 2009 09:33:31 -0000

Barbara.Rogo at uniroma1.it wrote:
>
>> Is there a command as "mat.or.vec(nr,nc)" to create an array
that I
>> must calculate with more cicle?
Hi Barbara,
The approach that I usually use is something like this:

new.matrix<-matrix(NA,nrow=3,ncol=3)

This creates a 3x3 matrix named "new.matrix" that is filled with NAs.
You can then replace the elements of the array with useful values
knowing that any value not replaced will remain NA.

Jim