Displaying 1 result from an estimated 1 matches for "bartab".
Did you mean:
badtab
2006 Apr 07
3
finding common elements in a list
...where I want to extract only the elements that occur
in every component. For instance in the list foo I want to know that the
numbers 2 and 3 occur in every component. The solution I have seems
unnecessarily clunky. TIA, Andy
foo <- list(x = 1:10, y=2:11, z=1:3)
bar <-unlist(foo)
bartab <- table(bar)
as.numeric(names(bartab)[bartab==length(foo)])
[[alternative HTML version deleted]]