I have a matrix with two columns some of the numbers are the same in both columns, but column 2 also contains some numbers which are not in column 1.
I would like to select those values in column2 that are not in column1 and insert them in column1 in increasing order.
As a start I was thinking of using some matrix operation like matrix[matrix[,1]%in%matrix[,2]
just instead of %in% using something for "not in".
Here's the datafile:
https://dl.dropbox.com/u/22681355/example.csv
example<-read.csv("example.csv")
example[,2] contains some numbers which example[,1] does not.
I would like to:
- search for these numbers using something equivalent to %not in %
Following the answer below I can do the following:
values<-setdiff(example[,2],example[,1]
order<-sort(values)