[R] how to resample (or resize) matrix?

Gabor Grothendieck ggrothendieck at gmail.com
Thu Jul 27 12:54:44 CEST 2006

Assuming the problem is to partition the 10x10 matrix x into 25 two by two
squares and then average each of those squares, try this:

   apply(array(x, c(2,5,2,5)), c(2,4), mean)

On 7/27/06, Vladimir Eremeev <wl at eimb.ru> wrote:
> Dear r-help,
>  I have a matrix, suppose, 10x10, and I need the matrix 5x5, having
>  in each cell a mean value of the cells from the initial matrix.
>  Please, point me to a function in R, which can help me doing that.
>  Digging the documentation and mail archives didn't give me a result.
>  Thank you.
> ---
> Best regards,
> Vladimir                mailto:wl at eimb.ru
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list