On 07/10/2010 4:10 AM, Ivan Calandra wrote:
  Hi,

I've just seen yesterday on ?plotmath the operator %notin%.
This could also work I guess.

No, that's just a way to encode the symbol for "not an element of". It's not actually an operator that works outside of plotmath (though you could make it one, as others have shown...)

Duncan Murdoch


Ivan

Le 10/7/2010 07:41, bill.venab...@csiro.au a écrit :
Try !(group %in% C("A", ...))

A slightly cuter way is to define your own operator.

`%ni%`<- Negate(`%in%`)
letters[1:3] %ni% letters[3:5]
[1]  TRUE  TRUE FALSE

________________________________________
From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of 
Emily Deomano [edeom...@bses.com.au]
Sent: 07 October 2010 09:17
To: r-help@r-project.org
Subject: [R] what is the "NOT IN" operator

Good day,
I need to subset a data by removing several rows.  I know the %in% operator, 
i.e.

sub<- mydata[group %in% c("A","B","E","G"), ]

What I need is the opposite, that is remove rows and/or columns.  What is the operator for 
"NOT IN"?  I tried  (i)! %in% and (ii) ^%in% and both resulted in a "could not find 
function" error.


Kind Regards

Emily Deomano  |  Biometrician
BSES Limited  |  ABN 29 103 760 005  |  PO Box 86  |  50 Meiers Road  |  
Indooroopilly Q 4068 Australia
P:  +61 7 3331 3304  |  M: +61 408 656 452  |  F: +61 7 3871 0383  |  E: 
edeom...@bses.com.au<mailto:edeom...@bses.com.au>   |  W: bses.com.au


-------------------- Internet e-Mail Disclaimer --------------------

PRIVILEGED - PRIVATE AND CONFIDENTIAL: This email and any files transmitted 
with it are intended solely for the use of the addressee(s) and may contain 
information, which is confidential or privileged. If you are not the intended 
recipient, be aware that any disclosure, copying, distribution, or use of the 
contents of this information is prohibited. In such case, you should destroy 
this message and kindly notify the sender by reply e-mail. The views and 
opinions expressed in this e-mail are those of the sender and do not 
necessarily reflect the views of the company.

VIRUSES:  Email transmission cannot be guaranteed to be secure or error free, 
as information may be intercepted, corrupted, lost, destroyed, arrive late or 
incomplete or contain viruses. This email and any files attached to it have 
been checked with virus detection software before transmission. You should 
nonetheless carry out your own virus check before opening any attachment. BSES 
Limited does not represent or warrant that files attached to this email are 
free from computer viruses or other defects and accepts no liability for any 
loss or damage that may be caused by software viruses

         [[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.

______________________________________________
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.



______________________________________________
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