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
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
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] [,
3 matches
Mail list logo