[R] Checking if an element is part of a vector

Roger D. Peng rpeng at jhsph.edu
Wed Oct 6 18:48:21 CEST 2004


element %in% vector

or look at match()


Dominik Bach wrote:
> Hi!
> I want to know if a given element <- ('c64') is part of a vector<- ('c64',  'amiga', 'atari'). 
> Does a function exist for this which gives back a logical value?
> thankx
> db
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

More information about the R-help mailing list