[S] Re: Extracting rows of a matrix with positive elements

Rolf Turner (rolf@math.unb.ca)
Sat, 21 Feb 1998 10:17:49 -0400 (AST)


> A method that will work, on a matrix denoted y, is
>
> y[(((y > 0) - 1) %*% rep(1, ncol(y))) == 0, ].
>
> Perhaps someone else will come up with an easier way.

I think that

y[apply(y>0,1,all),]

is sexier, if not easier.

cheers,

Rolf Turner
rolf@math.unb.ca
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news