I have a tibble with a column containing sample names ("sample") and a column containing gene names ("gene"). Each sample contains multiple genes, and each row shows a simple gene, so each sample spans a lot of rows.
I want to create a list which can be used for the ggvenn package. But so far, I have only managed to create a list where each sample shows up in multiple rows and each row only contains one gene. I would like to have one row per sample, where all the gene names are combined, and then use the Venn diagram to show how many genes are overlapping in each sample.
Can anyone help? Would be greatly appreciated! Best regards, Rasmus
Here is a solution that creates a wide format data frame that is also accepted by
ggvenn
.Created on 2022-09-21 by the reprex package (v2.0.1)