Re: [R] an operator for "contains"

From: Arne Henningsen <ahenningsen_at_agric-econ.uni-kiel.de>
Date: Sat 18 Jun 2005 - 06:42:50 EST

%in%

R> k <- 1:9
R> 3 %in% k
[1] TRUE
R> 33 %in% k
[1] FALSE Arne

On Friday 17 June 2005 22:31, Mike R wrote:
> 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@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

-- 
Arne Henningsen
Department of Agricultural Economics
University of Kiel
Olshausenstr. 40
D-24098 Kiel (Germany)
Tel: +49-431-880 4445
Fax: +49-431-880 1397
ahenningsen@agric-econ.uni-kiel.de
http://www.uni-kiel.de/agrarpol/ahenningsen/

______________________________________________
R-help@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
Received on Sat Jun 18 07:48:19 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:50 EST