Reputation: 5464
Say I'm training models:
lm.1, lm.2, ... , lm.100
I would like to refer back to these later in my code for various purposes: say to inspect coefficients, run test data against them, etc.
What data structure should I use to store them in?
A list is what I've been using but lists for some reason seem a bit unwieldy of all the data structures in R
Upvotes: 0
Views: 112
Reputation: 73385
It is certainly a list.
A complete lm object
is a list; the only thing in R that can hold a list is just a list. We have no other option.
In some cases, even if the return of a model is just a vector, we can not guarantee the resulting vectors are of equal length for all models we try, so we still have to use a list.
Upvotes: 3