I have a regression model created with by
. I know I can use sapply
to extract specific parts of the model for each factor, but what if I wanted something like the whole summary
, anova
, etc.?
model <- with(data, by(data, factor, function(data) lm(y ~ x, data=data)))