[Solved] Add a column for counting unique tuples in the data frame [duplicate]
1) aggregate ag <- aggregate(count ~ ., cbind(count = 1, df), length) ag[do.call(“order”, ag), ] # sort the rows giving: userID A B count 3 1 2 2 1 4 1 3 3 1 2 3 2 1 2 1 5 1 0 2 The last line of code which sorts the rows could be … Read more