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.gov>wrote: > 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.