On Sun, 18 Feb 2001 baron@cattell.psych.upenn.edu wrote:
> 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.
Yes, but one match or not for each instance of x.
> If you say
> x %in% y
> you get "TRUE" for every match, not just the first.
You get a result for each element of x, not y.
Both return a result for each element of x. match returns the index of the
first match or `nomatch', %in% returns TRUE or FALSE.
is.element is a synonym of %in% compatible with S, which uses %in% for
something else (nesting in formulae).
> This is useful, now that I know it, but perhaps the thing
> about the first instance should be documented.
Yes, ?match needs a `details' section. I'll add one.
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._