[R] Collapsing/aggregating columns in a matrix

Barth B. Riley bbriley at chestnut.org
Thu Mar 24 13:10:37 CET 2011


Dear list

I want to know if there is a function in R that enables one to create a new matrix based on values in an existing matrix, whereby each column in the new matrix is a row-specific summary (e.g., sum, mean) of multiple columns in the original matrix. For instance, to take a 12-column matrix and collapse it into a 3 column matrix containing the means for each row of columns 1-4, 5-8, and 9-12 of the original matrix. I want to do this with a large number of data matrices where the columns to collapse varies from dataset to dataset.

Thanks

Barth

PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.



More information about the R-help mailing list