I have several gene vector vectors containing the names of the species in which they are found, and I made an UpSetR graph to show the number of species found between genes. Now I would like to do the opposite: determining the number of common genes among species, but I do not know how to do this.
An example of what I have:
gene1 <- c("Panda", "Dog", "Chicken")
gene2 <- c("Human", "Panda", "Dog")
gene3 <- c("Human", "Panda", "Chicken")
...
An example of what I would like to have as a result:
Panda <- c("gene1", "gene2", "gene3")
Dog <- c("gene1", "gene2")
Human <- c("gene2", "gene3")
Chicken <- c("gene1", "gene3")
...
I know this is conceptually easy, but logically more complicated. Can someone give me a hint?
Thank!
source
share