Message-ID: <584299.40219.qm@web38704.mail.mud.yahoo.com>
Date: 2009-11-18T12:18:08Z
From: lloyd barcza
Subject: reduce matrix
I am trying to reduce the dimension of matrix by removing zero elements and creating a sub-matrix.
For example:
A= [1,0,0,3; 0,1,2,0; 0,0,3,5]
then the new matrix B would be:
B= [1,3;1,2;3,5]
There are the same number of zero elements in each row of A so dimension of B will not be a problem. Is there a straightforward way to do this in R without writing a function using loops etc?
Any help or suggestions would be appreciated!
Thanks