[R] Finding common an unique elements in character vectors
David Winsemius
dwinsemius at comcast.net
Mon Mar 29 21:31:51 CEST 2010
On Mar 29, 2010, at 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,
> Portugal)
>
> vector_2 <- c(Denmark, Luxembourg)
>
> I would like to find the elements in vector_1 that are not in vector_2
?"%in%"
# the help page for %in% also defines a %w/o% operator as a worked
example.
>
> so that i get a vector with these countries: Belgium, Spain, Greece,
> Ireland, Netherlands, Portugal.
>
> Thanks a lot,
>
> Thomas
>
> ______________________________________________
> 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list