You can use aggregate
for this task:
aggregate(cbind(timeid, levelid) ~ uid + created, sbw0214, min)
uid created timeid levelid
1 7484797 1391578980 1391626414 17
2 6580096 1391707958 1392149148 11
3 859053 1392080130 1392703139 12
4 5878556 1392092198 1392092388 14
5 6993255 1392318992 1392391040 9
6 6582371 1392400831 1392584819 10
7 7437087 1392734333 1392832005 8
Update based on comment:
If you want to apply different functions, the package plyr
is very helpful.
library(plyr)
ddply(sbw0214, .(uid, created), summarise,
timeid = min(timeid),
price = sum(price))
uid created timeid price
1 859053 1392080130 1392703139 6.99
2 5878556 1392092198 1392092388 944.00
3 6580096 1391707958 1392149148 66.00
4 6582371 1392400831 1392584819 7.48
5 6993255 1392318992 1392391040 15.48
6 7437087 1392734333 1392832005 7.97
7 7484797 1391578980 1391626414 19.99