[R] Subset in, not in

David Winsemius dwinsemius at comcast.net
Thu Jan 10 22:00:53 CET 2013


On Jan 10, 2013, at 12:04 PM, Patrick Burns wrote:

> Did you try:
>
> mm <- subset(agr1, subset= !(lmpcrd %in% c(11697,149823,7654)))

And it might be noted that this is part of the last example on the  
help page:

?'%in%'

-- 
David.

>
> (Actually the parentheses that I added are
> not necessary, but they make me feel better.)
>
> Pat
>
> On 10/01/2013 19:54, ramoss wrote:
>> Hello,
>>
>> I need to subset my dataframe into 2 parts;  in:   mm <- subset(agr1,
>> subset=lmpcrd %in% c(11697,149823,7654))
>> not in:  but where do I stick the " !" in the above?  I've tried  
>> every
>> position.
>>
>> Thanks for your help.
>>
-- 

David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list