I have two character vectors, x and y.
x <- c("a", "b", "c", "d", "e", "f", "g")
y <- c("a", "c", "d", "e", "g")
The values inside x do not ever repeat (i.e., they are all unique). The same goes for vector y. My question is, how can I get R to compare the two vectors, and then tell me which elements are missing from y with respect to x? Otherwise stated, I want R to tell me that "b" and "f" are missing from y.
(Note, in my real data, x and y each contain a few thousand observations, which is why I would like to do this programmatically. There is likely a very simple answer, but I wasn't sure what to search for in the R help files).
Thanks to anyone who can help!