On a thread on CrossValidated, I made the following comment:
I suspect this is actually an R question about the difference between working with
S3
classes (that are accessed via$
) &S4
classes (that are accessed via@
)...
@Gavin Simpson subsequently commented:
@gung is more than likely spot on, but the solution is probably not to delve into objects and rip out whatever you feel but to learn to use extractor functions, in this case
coefficients()
or its shorter aliascoef()
, as incoef(fit)
I'm intrigued by this. Why would using coef(model)
be better than model$coefficients[,1]
, for example? (I recognize that the latter is uglier and requires slightly more typing, but I doubt that's the reason intended.) What about the case where there isn't an existing extractor function (e.g., accessing the t-statistics)?