Unique and duplicated in R