I have the following situation:
vec1 <- c("A", "B", "D", "C", "E", "A", "C")
vec2 <- c("A", "B", "C", "D", "F")
First question: which one is duplicated ? – answer “A” and “C” for vec1, 0 for vec2
Second question: Identify which is vec1 but not in vec2, irrespective of order (answer “E”)
or vice versa (answer “F”)
which(vec1 !=vec2)
which(vec2 !=vec1)
[1] 3 4 5 7
Warning message:
In vec1 != vec2 :
longer object length is not a multiple of shorter object length
which is not what I expected….
Elements in vec1 that are duplicated:
Elements in vec1 that are not in vec2:
And vice versa: