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 alias
coef()
, as in coef(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)?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…