On Jun 2, 2011, at 11:35 AM, Petr Savicky wrote:
On Thu, Jun 02, 2011 at 11:23:28AM -0400, Jim Silverton wrote:
Hi,
Can someone tell me how to remove rows of zeros from a matrix?
For example if I have the following matrix,
0 0
0 1
2 8
0 0
4 56
I should end up with
0 1
2 8
4 56
Hi.
Try the
On Thu, Jun 02, 2011 at 11:23:28AM -0400, Jim Silverton wrote:
> Hi,
> Can someone tell me how to remove rows of zeros from a matrix?
> For example if I have the following matrix,
>
> 0 0
> 0 1
> 2 8
> 0 0
> 4 56
>
> I should end up with
> 0 1
> 2 8
> 4 56
Hi.
Try the following
a <- matrix(c
Assuming the matrix is named X:
X[which(rowSums(X) > 0),]
should work.
Also, this list is a text-only list. As you are using gmail, sending
text only messages is very easy, and may clear confusion in future
posts.
HTH,
Jon
On Thu, Jun 2, 2011 at 11:23 AM, Jim Silverton wrote:
> Hi,
> Can som
Hi,
Can someone tell me how to remove rows of zeros from a matrix?
For example if I have the following matrix,
0 0
0 1
2 8
0 0
4 56
I should end up with
0 1
2 8
4 56
--
Thanks,
Jim.
[[alternative HTML version deleted]]
__
R-help@r-project.or
4 matches
Mail list logo