Hi:
Here's an example of how to extract pieces from model objects using the plyr
package. I'm using the attitude data set from the datasets package
(autoloaded).
# Generate four models
m1 <- lm(rating ~ ., data = attitude)
m2 <- lm(rating ~ complaints + learning, data = attitude)
m3 <- lm(rating
This is FAQ 7.21.
The real gem in the answer there is at the end where it tells you that it is
easier to just use a list. If your fit1, fit2, fit3, and fit4 were elements in
a list then you can just loop through the list elements, or even easier use the
lapply function to loop through the list
2 matches
Mail list logo