[R] Function to check if a vector contains a given value?
Dimitri Liakhovitski
ld7631 at gmail.com
Wed Sep 23 17:49:15 CEST 2009
Thanks a lot, Jorge!
On Wed, Sep 23, 2009 at 11:42 AM, Jorge Ivan Velez
<jorgeivanvelez at gmail.com> wrote:
> 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.Liakhovitski at ninah.com
>>
>> ______________________________________________
>> R-help at 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.
>
>
--
Dimitri Liakhovitski
Ninah.com
Dimitri.Liakhovitski at ninah.com
More information about the R-help
mailing list