[R] position of an element in a vector
mschwartz at medanalytics.com
Thu Feb 13 23:00:37 CET 2003
>From: r-help-admin at stat.math.ethz.ch
>[mailto:r-help-admin at stat.math.ethz.ch] On Behalf Of Jason Bond
>Sent: Thursday, February 13, 2003 3:41 PM
>To: R-help at stat.math.ethz.ch
>Subject: [R] position of an element in a vector
>Hello. Sorry for the elementary post. I've looked through the
>documentation, but can't seem to find a function which allows one to
>extract the position of an element within a list...for example
>of the element 4 in the vector c(1,2,4,3,6) is 3. Thanks much
>for any help.
Take a look at ?which.
> which(c(1,2,4,3,6) == 4)
More information about the R-help