Re: [R] Conditional rows

From: Gabor Csardi <csardi_at_rmki.kfki.hu>
Date: Mon, 11 Feb 2008 11:27:29 +0100

which(apply(test<=0.2, 1, all))

See ?which, ?all, and in particular ?apply.

Gabor

On Mon, Feb 11, 2008 at 06:22:09PM +0800, Ng Stanley wrote:
> Hi,
>
> Given a simple example, test <- matrix(c(0.1, 0.2, 0.1, 0.2, 0.1, 0.1, 0.3,
> 0.1, 0.1), 3, 3)
>
> How to generate row indexes for which their corresponding row values are
> less than or equal to 0.2 ? For this example, row 2 and 3 are the correct
> ones.
>
> Thanks
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Csardi Gabor <csardi_at_rmki.kfki.hu>    UNIL DGM

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 11 Feb 2008 - 10:41:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 11 Feb 2008 - 14:00:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive