There are three lists:
list1 <- c("123","124","126","131")
list2 <- c("111","123","126","133","159")
list3 <- c("119","120","123","124","126","158")
Here, I have to extract the elements that are contained across all the lists. In this case, the new list, say mylist
should contain "123"
and "126"
. How can do this in R?