Hi Dimitri,
See either ?any,  ?"%in%", or  ?intersect

any(x == 2)
# [1] TRUE

HTH,
Jorge

On Wed, Sep 23, 2009 at 11:37 AM, Dimitri Liakhovitski <> wrote:

> Dear R'rs,
>
> is there a function that checks if a given vector contains a certain value.
> E.g., x<-c(1,2,3,4).
> How can I get a TRUE or FALSE for whether x contains a 2?
>
> --
> Dimitri Liakhovitski
> Ninah.com
> dimitri.liakhovit...@ninah.com
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to