[R] element of

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed May 7 18:23:03 CEST 2003

Do you mean *an* element or *this* element of a matrix?

is.element or %in% for the first
== for the second.

It doesn't really make sense for a data frame, where columns can be of 
arbitrary classes.

I am not sure if I have unscrambled your English correctly: if not a 
simple example of what you want to do would help.  (We don't need examples 
of logical values, though.)

On Wed, 7 May 2003 alexander.schnee at tuebingen.mpg.de wrote:

> is there any funktion in R which i can use to check if a single value is
> element of a matrix or data.frame so that it returns me logical values
> like TRUE/FALSE.

(or possibly NA if there are NAs in the matrix?)

Brian D. Ripley,                  ripley at 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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list