Re: [R] removing zero rows from matrix/table

2008-04-22 Thread Dimitris Rizopoulos
TED]> Sent: Tuesday, April 22, 2008 11:52 AM Subject: [R] removing zero rows from matrix/table > Dear R-community, > I have matrices/tables of different sizes which may contain rows > with > only zeros. Now I would like to delete these zero lines or create > new > matrices c

Re: [R] removing zero rows from matrix/table

2008-04-22 Thread Gabor Csardi
See ?apply M2 <- M[ apply(M!=0, 1, any), , drop=FALSE] Gabor On Tue, Apr 22, 2008 at 11:52:08AM +0200, Patrick Zimmermann wrote: > Dear R-community, > I have matrices/tables of different sizes which may contain rows with > only zeros. Now I would like to delete these zero lines or create new > m

[R] removing zero rows from matrix/table

2008-04-22 Thread Patrick Zimmermann
Dear R-community, I have matrices/tables of different sizes which may contain rows with only zeros. Now I would like to delete these zero lines or create new matrices composed only of the non-zero lines. Columns only containing zeros I want to preserve. Here an example: [,1] [,2] [,3] [,4] [,5] [,