[R] $

Ben Bolker bolker at ufl.edu
Tue Jun 20 19:27:15 CEST 2006

Davis, Jacob B.  <JBDavis <at> txfb-ins.com> writes:

> Thanks for humbling yourself to my level and not answering my question.
> If object is user defined is:
>  object$df.residual 
>  the same thing as
>  df.residual(object)

  df.residual() is an extractor function.

stats:::df.residual.default gives:

function (object, ...)
<environment: namespace:stats>

  so yes, in general they are the same thing.
It's better to use the extractor function rather than $
if possible;
while it doesn't appear that anyone has written a
class of objects that have a different method
for extracting the residual degrees of freedom,
they could -- or someone could change the
internal representation of lm and glm objects
(unlikely though that is) to mean that 
object$df.residual was missing, or even wrong.

  Ben Bolker

More information about the R-help mailing list