I've found many pages about finding duplicated elements in a list or duplicated rows in a data frame. However, I want to search for duplicated elements throughout the entire data frame. Take this as an example:
df
coupon1 coupon2 coupon3
1 10 11 12
2 13 16 15
3 16 17 18
4 19 20 21
5 22 23 24
6 25 26 27
You'll notice that df[2,2] and df[3,1] have the same element (16). When I run
duplicated(df)
It returns six "FALSE"s because the entire row isn't duplicated, just one element. How can I check for any duplicated values within the entire data frame? I would like to both know the duplicate exist and also know its value (and the same if there's multiple duplicates).
duplicated(matrix(df, ncol=1))