Re: [R] simple index question

From: Marc Schwartz (via MN) <mschwartz_at_mn.rr.com>
Date: Fri 02 Jun 2006 - 01:10:32 EST

On Thu, 2006-06-01 at 11:06 -0400, Mu Tian wrote:
> I want to get index number of 0s, like
>
> x <- c(1, 2, 0, 3, 0, 4)
>
> I want an output of
>
> 3, 5
>
> Thank you.

See ?which

> which(x == 0)
[1] 3 5

HTH, Marc Schwartz



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jun 02 02:58:55 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 02 Jun 2006 - 04:10:27 EST.

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