Hi Lazarus,

Checkout arrays (?array). You can cast your matrix to an array of
submatrices, and calculate the means per block using apply.

Cheers,

Tsjerk

On Mar 14, 2012 9:25 AM, "Lazarus Mramba" <lmra...@gmail.com> wrote:

Dear all,

I have a large matrix with about 2500 variables, and 100 rows.

I would like to calculate the means of the every 10 variables starting from
1:2500  and saving the results as a vector or matrix.
How can I do that?
Alternatively, How can I create 250 subset matrices in the order of
variables 1:2500 in groups of 10 from the single matrix which had initially
2500 variables ?
I guess I have to use a loop, but I can't figure out how.

Any help will be appreciated,

Regards,
Lazarus

       [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to