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 <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED] > > ______________________________________________ > R-help@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. > ______________________________________________ R-help@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.