Reputation: 8015
Column1A<-Dat$col1
Column1B<-Dat2$col2
Both columns, column1A and column1B consist of mixed values, such as ABC1, 234,etc. Besides, each column can have duplicate entries. For instance,
Column1A
ABC1 ABC2 1234 ABC1
Column1B
ABC2 ABC3 1234
Is there a way to get the unique entry list for each column. If the unique entry list are difference for two columns, how to find the differences?
Upvotes: 0
Views: 76
Reputation: 55420
since your data is already in a data.frame or a list, no need to first copy them out. Just use apply
:
apply(Dat, 2, unique)
Upvotes: 0
Reputation: 9018
unique
should work in getting unique values for a list.
For searching the different terms in two unique lists, you can just simply go through one of the list, and for each element of that list, check if that is in the other list.
A simple while loop should work, and you stop at the point when you cannot find an element from list 1 in list 2.
Upvotes: 1
Reputation: 81753
You can use unique
to find the unique values:
unique(Column1A)
unique(Column1B)
Upvotes: 0