Don’t worry about the details ofprint.lm(). The main point is that the
printing depends on context, with a special print function called for the
"lm"class. Now let’s see what happens when we print this object with its
class attribute removed:
> unclass(lmout)
$coefficients
(Intercept) x
-3.0 3.5
$residuals
123
0.5 -1.0 0.5
$effects
(Intercept) x
-6.928203 -4.949747 1.224745
$rank
[1] 2
I’ve shown only the first few lines here—there’s a lot more. (Try run-
ning this on your own!) But you can see that the author oflm()decided
to makeprint.lm()much more concise, limiting it to printing a few key
quantities.
9.1.3 Finding the Implementations of Generic Methods...................
You can find all the implementations of a given generic method by calling
methods(), like this:
> methods(print)
[1] print.acf*
[2] print.anova
[3] print.aov*
[4] print.aovlist*
[5] print.ar*
[6] print.Arima*
[7] print.arima0*
[8] print.AsIs
[9] print.aspell*
[10] print.Bibtex*
[11] print.browseVignettes*
[12] print.by
[13] print.check_code_usage_in_package*
[14] print.check_demo_index*
[15] print.checkDocFiles*
210 Chapter 9