I want to separate a dataset into 2, one contains duplicated rows and another one contains unique rows. One dataset only has unique rows if using distinct(id,.keep_all=T) , but lost duplicated rows. How generate 2 sets and keep both rows? Thanks in advance!
employee <- c('John','Peter','Jolie','Hot')
salary <- c(21000, 23400, 26800, 23000)
id <- c(1,2,3,1)
data <- data.frame(employee, salary, id, stringsAsFactors=FALSE)