removeMatches.RdIf a vector has c("A", "b", "c") and we want to remove "b" and "c", this function can do the work. It can also replace "b" and "c" with the NA symbol.
removeMatches(x, y, padNA = FALSE)a vector with elements in y removed
If elements in y are not members of x, they are silently ignored.
The code for this is not complicated, but it is
difficult to remember. Here's the recipe to remove
elements y from x: x <- x[!x %in% y[y %in% x]]. It is
easy to get that wrong when in a hurry, so we use this function
instead. The padNA was an afterthought, but it helps sometimes.