[Rd] match vs. %in% (PR#853)

baron@cattell.psych.upenn.edu baron@cattell.psych.upenn.edu
Sun, 18 Feb 2001 22:43:52 +0100 (MET)


This isn't really a bug so much as an undocumented feature, but
perhaps the help file should be changed.

If you say
match(x,y)
you get the values of the _first_ instance in y that matches each
value of x.

If you say 
x %in% y
you get "TRUE" for every match, not just the first.

This is useful, now that I know it, but perhaps the thing
about the first instance should be documented.

I still don't understand why it happens!

Jon

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._