[R] Finding missing elements by comparing vectors

2009-07-16 Thread Praveen Surendran
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@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.


Re: [R] Finding missing elements by comparing vectors

2009-07-16 Thread Steve Lianoglou
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).


I think you're looking for setdiff

-steve

--
Steve Lianoglou
Graduate Student: Physiology, Biophysics and Systems Biology
Weill Medical College of Cornell University

Contact Info: http://cbio.mskcc.org/~lianos/contact

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


Re: [R] Finding missing elements by comparing vectors

2009-07-16 Thread David Huffer
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-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Praveen Surendran
Sent: Thursday, July 16, 2009 11:42 AM
To: r-help@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@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.


Re: [R] Finding missing elements by comparing vectors

2009-07-16 Thread Jorge Ivan Velez
This is just a variation of David's solution below:
intersect(X,Y)
# [1] red   blue  green

HTH,

Jorge


On Thu, Jul 16, 2009 at 12:07 PM, David Huffer david.huf...@csosa.govwrote:

 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-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Praveen Surendran
 Sent: Thursday, July 16, 2009 11:42 AM
 To: r-help@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@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.


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