R objects come with various methods that make them useful. I tend to stumble over these by googling something I want to do, and finding some code example on StackOverflow. But today I learned (from @RLangTip) that there is a straightforward way to list them all: you simply call e.g., methods(class='lm')
.
That's nice, but mileage varies and I don't have a good explanation for it. Take Zelig for example. It has this sim()
function which produces a simulation object with some methods of its own. One of these is plot.ci()
, illustrated here. Unfortunately, you won't find it with the methods()
call:
> library("Zelig", lib.loc="C:/Program Files/R/library")
Loading required package: boot
Loading required package: MASS
Loading required package: sandwich
ZELIG (Versions 4.2-2, built: 2013-10-22)
+----------------------------------------------------------------+
| Please refer to http://gking.harvard.edu/zelig for full |
| documentation or help.zelig() for help with commands and |
| models support by Zelig. |
| |
| Zelig project citations: |
| Kosuke Imai, Gary King, and Olivia Lau. (2009). |
| ``Zelig: Everyone's Statistical Software,'' |
| http://gking.harvard.edu/zelig |
| and |
| Kosuke Imai, Gary King, and Olivia Lau. (2008). |
| ``Toward A Common Framework for Statistical Analysis |
| and Development,'' Journal of Computational and |
| Graphical Statistics, Vol. 17, No. 4 (December) |
| pp. 892-913. |
| |
| To cite individual Zelig models, please use the citation |
| format printed with each model run and in the documentation. |
+----------------------------------------------------------------+
Attaching package: ‘Zelig’
The following object is masked from ‘package:utils’:
cite
> methods(class='sim')
[1] plot.sim* print.sim* repl.sim* simulation.matrix.sim*
[5] summary.sim
Non-visible functions are asterisked
See that? There's a non-visible plot()
method listed, but no plot.ci()
method, yet it exists and it works. I wonder why that is. Is it maybe that plot.ci()
is some kind of child of plot()
? If so, how do you list such children?