[R] an operator for "contains"

Huntsinger, Reid reid_huntsinger at merck.com
Fri Jun 17 22:40:59 CEST 2005


Yes, %in% or is.element().

Reid Huntsinger

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Mike R
Sent: Friday, June 17, 2005 4:32 PM
To: r-help at stat.math.ethz.ch
Subject: [R] an operator for "contains"


k = c(1:9)
if( length( which(k==3) ) ){ print("contained") }else{ print("not
contained") }

is therre a simple way to test if a vector/list contains a particular value?

for example an operator, along the lines of: ==

more generally, is the a documentaion page that lists/describes all
such operators?

lastly, if you didn't know the answer to my question, how would you have
gone about searching for an answer?  I tried RSiteSearch() using various
terms, and I opened  R-2.1.0/library/base/html/00Index.html and searched
for various terms.

TIA

======================
platform i686-pc-linux-gnu
arch     i686             
os       linux-gnu        
system   i686, linux-gnu  
status                    
major    2                
minor    1.0              
year     2005             
month    04               
day      18               
language R

______________________________________________
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