>-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED]] On Behalf Of Jason Bond >Sent: Thursday, February 13, 2003 3:41 PM >To: [EMAIL PROTECTED] >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 >the position >of the element 4 in the vector c(1,2,4,3,6) is 3. Thanks much >for any help. > > Jason
Take a look at ?which. For example: > which(c(1,2,4,3,6) == 4) [1] 3 Regards, Marc ______________________________________________ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
