I am trying check duplicates in data frame but while check its just showing duplicate for second and third and so on text but it should show all records which are duplicate.
do we have any other solution or am i missing something else...??
df4 <- data.frame(emp_id =c("DEV-2962","KTN_2252","ANA2719","ITI_2624","DEV2698","HRT2921","","KTN2624","DEV2698","ITI2535","DEV2698","HRT2837","ERV2951","KTN2542","ANA2813","ITI2210"))
df4 <- df4 %>% mutate(`emp_unq` = ifelse(duplicated(emp_id, incomparables=c("", NA)),"duplicate emp",""))
the output should be like
emp_id | emp_unq |
---|---|
DEV2698 | duplicate emp |
DEV2698 | duplicate emp |
DEV2698 | duplicate emp |