For example, I have 2 chairs and one table in set1 and 1 chair in set2.
I want to subtract set2 from set1 and want the result as c("chair", "table")
set1 <- c("chair", "chair", "table")
set2 <- c("chair")
setdiff(set1, set2)
gives "table"
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…