On Oct 6, 2010, at 9:03 PM, Christian Raschke wrote:

Put the "!" in front of the whole expression, not just the %in%
function. I.e.

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

You can also look at the match help page where %in% and its negation, %w/o% , are illustrated.

--
David.


Christian

On Thu, 2010-10-07 at 09:17 +1000, Emily Deomano wrote:
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.

David Winsemius, MD
West Hartford, CT

______________________________________________
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