Re: [R] Mean-replacing NAs in a 3d array

2009-03-20 Thread Eik Vettorazzi
Hi Tom, it would have been nice (and it is in fact requested by the posting guide) to give a running example instead of letting us construct your data. Anyway, it wasn't too hard with Xa<-array(1:12,dim=c(2,2,3)) Xa[c(2,6,8)]<-NA #so next, create a vector for the colMeans with length 2*2*3, rep

[R] Mean-replacing NAs in a 3d array

2009-03-19 Thread T.R. Marshall
Hi all I have a 3d array containing missing values. > Xa , , 1 [,1] [,2] [1,]13 [2,] NA4 , , 2 [,1] [,2] [1,]57 [2,] NA NA , , 3 [,1] [,2] [1,]9 11 [2,] 10 12 I want to replace the missing values with the mean, but the mean of each 'page' i