[R] find position

From: gallon li <gallon.li_at_gmail.com>
Date: Sun, 10 Jun 2007 16:45:58 +0800

find the position of the first value who equals certain number in a vector:

Say a=c(0,0,0,0,0.2, 0.2, 0.4,0.4,0.5)

i wish to return the index value in a for which the value in the vector is equal to 0.4 for the first time. in this case, it is 7.

        [[alternative HTML version deleted]]

R-help_at_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 and provide commented, minimal, self-contained, reproducible code. Received on Sun 10 Jun 2007 - 08:52:43 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 Sun 10 Jun 2007 - 14:31:41 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.