I have a data frame that looks like this:
date time id datetime 1 2015-01-02 14:27:22.130 999000000007628 2015-01-02 14
You can use the uniqueN function from data.table:
uniqueN
data.table
library(data.table) setDT(df)[, uniqueN(id), by = date]
or (as per the comment of @Richard Scriven):
aggregate(id ~ date, df, function(x) length(unique(x)))