on="id")
# join 类似sql中的join,比merge速度更快
first <- ddply(baseball, "id", summarise, first = min(year))
system.time...(b2 <- merge(baseball, first, by = "id", all.x = TRUE))
system.time(b3 <- join(baseball, first, by =...(llply(x,wait))
system.time(sapply(x,wait))
install.packages("doMC")
library(doMC)
registerDoMC(2)
system.time...(llply(x,wait,.parallel=T))
# plyr flaws: low speed than build-in function
system.time(ddply(baseball...,"id",summarize,length(year)))
system.time(tapply(baseball$year,baseball$id,function(x) length(x)))
参考资料