I'm trying to get duplicate values within groups. More specifically I want to check duplicate Child ID within each household, but duplicate Child ID across different households are fine. For example, I have a data frame called "village":
village <- data.frame(household = c(1, 1, 1, 2, 3, 3),
children = c("A001", "A002", "A001", "A004", "A005", "A001"))
I want to get an output of:
expected <- data.frame(household = c(1, 1),
children = c("A001", "A001"))