[R] searching a vector

tobias.verbeke@bivv.be tobias.verbeke at bivv.be
Fri Apr 30 15:41:47 CEST 2004





r-help-bounces at stat.math.ethz.ch wrote on 30/04/2004 15:33:48:

> Hi,
>
> I have a integer vector x that contains a unique set of numbers:
>
> x <- c(1,2,4,6,8,10,12)
>
> Is there a simple test I can use to determine if an integer such as 6 is
> contained in x ?

> x <- c(1,2,4,6,8,10,12)
> 6 %in% x
[1] TRUE

See ?"%in%" and its 'See also:' section.


HTH,
Tobias




More information about the R-help mailing list