Hello. The data.table package is very helpful in terms of speed. But I am having trouble actually using the output from linear regression. Is there any way to get the data.table output to be as pretty/useful as that from the plyr package? Below is an example.
library('data.table'); library('plyr'); REG <- data.table(ID=c(rep('Frank',5),rep('Tony',5),rep('Ed',5)), y=rnorm(15), x=rnorm(15), z=rnorm(15)); REG; #The ddply function from the plyr package produces very neat and useful output; ddply(REG, .(ID), function(x) coef(lm(y ~ x + z, data=x))); #The data.table output is fast, but not very neat (in terms of the order of the coefficient estimates). Is there any way to get the data.table output to look more like the plyr/ddply output (without making a list for each coef and running the regression two times)? REG[, coef(lm(y ~ x + z)), by=ID]; Thank you! Geoff [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.