Re: [R] separate row averages for different parts of an array

2006-08-17 Thread Gabor Grothendieck
The following reshapes mat so we can take the means of the columns of the resulting 3d array and then transposes it back to the original orientation: t(colMeans(array(t(mat), c(100, 448, 24 You might want to try it on this test set first where anscombe is an 11x8 data set built into R.

[R] separate row averages for different parts of an array

2006-08-16 Thread Spencer Jones
I have an array with 44800 columns and 24 rows I would like to compute the row average for the array 100 columns at a time, so I would like to end up with an array of 24 rows x 448 columns. I have tried using apply(dataset, 1, function(x) mean(x[])), but I am not sure how to get it to take the

Re: [R] separate row averages for different parts of an array

2006-08-16 Thread Marc Schwartz (via MN)
On Wed, 2006-08-16 at 11:36 -0600, Spencer Jones wrote: I have an array with 44800 columns and 24 rows I would like to compute the row average for the array 100 columns at a time, so I would like to end up with an array of 24 rows x 448 columns. I have tried using apply(dataset, 1, function(x)

Re: [R] separate row averages for different parts of an array

2006-08-16 Thread vincent
Spencer Jones a écrit : I have an array with 44800 columns and 24 rows I would like to compute the row average for the array 100 columns at a time, so I would like to end up with an array of 24 rows x 448 columns. I have tried using apply(dataset, 1, function(x) mean(x[])), but I am not sure