not-in-list

Problem: you have a long sorted list of numbers, but not all numbers in the range are present. How do you find the absent numbers?

keep.these <- sample.int(3000, 2995, replace = FALSE)
> which(1:max(keep.these) %in% keep.these == F)
[1]   69  963 2161 2182 2449

Useful when you want to debug selections.

comments powered by Disqus


Back to the index

Blog roll

R-bloggers, Debian Weekly
Valid XHTML 1.0 Strict [Valid RSS] Valid CSS! Emacs Muse Last modified: oktober 17, 2019