I'm experimenting with data.table's ability to hold lists - in this case the output of linear models
require(data.table)
ir <- data.table(iris)
setkey(ir, Species)
lm.mods <- ir[, list(mods=list(lm(Sepal.Length~Sepal.Width))), by="Species"]
I can access a single model
lm.mods[1 , summary(mods[[1]])]
But I can't work out how to create a new variable that is a list containing the summary of each model. I think it may require .SD
or :=
but I can't work it out.
Any suggestions?