I'm trying to count how often an id appears more than once on the same day in my data.
I have a column of dates and column of personal ids.
set.seed(42)
n <- 10^5
ids <- sample(1:5000, n, replace=T)
dates <- as.Date("1943-07-13", "%Y-%m-%d") - sample(1:9000, n, replace=T)
The solution I have come up with:
sum(table(ids, dates)>1)
The problem is (lack of) efficiency. On a bigger data set I get an error message.