[R] Test for list membership
Marcin Włodarczak
mwlodarczak at uni-bielefeld.de
Mon May 30 19:55:17 CEST 2011
On 05/30/2011 04:14 PM, Uwe Ligges wrote:
> On 30.05.2011 15:36, Marcin Wlodarczak wrote:
>>
>> Hi,
>>
>> I need some help with this one: how do I check whether a vector is
>> already present in a list of vectors.
>>
>> I have seen %in% recommended in a similar case but that obviously does
>> not work here.
>>
>> c(1,2,3) %in% list(c(1,2,3), c(4,5,6))
>
>
> You said it yourself, almost:
>
> list(c(1,2,3)) %in% list(c(1,2,3), c(4,5,6))
Brilliant! Thanks to everyone.
Marcin
More information about the R-help
mailing list