[R] Finding common an unique elements in character vectors
ccleland at optonline.net
Mon Mar 29 21:30:56 CEST 2010
On 3/29/2010 1:53 PM, Thomas Jensen wrote:
> Dear R-list,
> I have a problem which I think is quite basic, but so far google has not
> helped me.
> I have two vectors like this:
> vector_1 <- c(Belgium, Spain, Greece, Ireland, Luxembourg, Netherlands,
> vector_2 <- c(Denmark, Luxembourg)
> I would like to find the elements in vector_1 that are not in vector_2
> so that i get a vector with these countries: Belgium, Spain, Greece,
> Ireland, Netherlands, Portugal.
vector_1 <- c('Belgium', 'Spain', 'Greece', 'Ireland', 'Luxembourg',
vector_2 <- c('Denmark', 'Luxembourg')
> Thanks a lot,
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894
More information about the R-help