What is the best way to find out what elements/numbers that are in one
object are not in another.


I came up with this method, but I'm wondering if there is a more efficient
way (and one that doesn't seem so "clunky").

#Example

id <- c(1,2,3,4,5,6,7,9,10)

example.1 <- data.frame(id)

#Second object, this time with an 8 in it.

id <- c(1,2,3,4,5,6,7,8,9,10)

example.2 <- data.frame(id)

finder <- example.2$id %in% example.1$id

example.2 <- cbind(example.2,finder)

missing.list <- subset(example.2, test2==F)

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  • [R] Matching - find... James Holland

Reply via email to