Suppose I have 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]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to