[R] Finding missing elements by comparing vectors

David Huffer David.Huffer at csosa.gov
Thu Jul 16 18:07:28 CEST 2009


Or...

> X = c ("red", "blue", "green", "black" ) ;  Y = c("red", "blue",
"green", "magenta", "cyan")
> unique ( c ( X [X %in% Y] , Y [Y %in% X] ) )
[1] "red"   "blue"  "green"
>  

David 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Praveen Surendran
Sent: Thursday, July 16, 2009 11:42 AM
To: r-help at r-project.org
Subject: [R] Finding missing elements by comparing vectors

Hi,

 

Is there a function in R to do a-b where a and b are two non-numeric
sets
(or intersection complement of these two sets).

 

Kind Regards,

 

Praveen.

 


	[[alternative HTML version deleted]]

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




More information about the R-help mailing list