We have three places were we keep our records for our mice cages' numbers in our lab:
- Website for university where they bill us
- Personal excel sheet
- Website for our whole lab
I'm trying to organize them to make sure every entry is present in all three places and not missing from one of them.
Is there a way to give me which cage number is present in all three, and which is present in only one or two?
CodePudding user response:
If we need to know numbers that are present in all, intersect
is good
Reduce(intersect, lst1)
where lst1
is a list
of three vectors. To find the count of elements that are present, unlist
the list
elements and get the frequency count with table
table(unlist(lst1))
If we need to know which item is present or not, stack
on a named list
and get the table
table(stack(setNames(lst1, seq_along(lst1))))