Remove duplicates by multiple conditions
问题 I have data where an individual (Name) appears multiple times in a eggphase category. I would like for there only to be one sample per individual but I don't just want to keep the first one the R finds. I would like to keep the one where the group appears most in all other categories. Hopefully my example helps make this clear. library(tidyverse) myDF <- read.table(text="Tissue Food Eggphase Name Group wb fl after Kia a wb fl after Kia c wb wf before Kia b wb fl before Lucy c wb fl after Lucy