I want to identify duplicates in my data and put the duplicates in a df. My data looks like this:
id x
1-1 2
1-2 4
1-2 4
2-1 5
3-1 6
I want:
id x dup
1-1 2 FALSE
1-2 4 TRUE
1-2 4 TRUE
2-1 5 FALSE
3-1 6 FALSE
I tried:
duplicated(df$ID, incomparables = FALSE)
m1 <- matrix(x, ncol=3059, byrow=TRUE)
d1 <- as.data.frame(m1, stringsAsFactors=FALSE)
However, this isn't working. Can anyone help?