From: Gavin Simpson <gavin.simpson_at_ucl.ac.uk>

Date: Fri, 26 Aug 2011 23:17:03 +0100

Date: Fri, 26 Aug 2011 23:17:03 +0100

On Fri, 2011-08-26 at 07:06 -0700, Martin Morgan wrote:

> On 08/26/2011 04:44 AM, Gavin Simpson wrote:

*> > Dear List,
**> >
**> > This may be related to this email thread initiated by Ben Bolker last
**> > month: https://stat.ethz.ch/pipermail/r-devel/2011-July/061630.html
**> >
**> > In answering this Question on StackOverflow
**> > http://stackoverflow.com/q/7195628/429846 I noticed that `methods()` was
**> > not listing some S3 methods for `plot()` provided by the mgcv package.
**>
**> Hi Gavin --
**>
**> In the mgcv NAMESPACE, the methods is not registered with S3method
**> (which would have made it appear with a *) and is not export'ed; the
**> author of the package apparently intends that it be strictly internal to
**> the package. Dispatch works within the package name space, but not
**> outside, e.g., a=list; class(a) = "mgcv.smooth"; plot(a) ends up at
**> plot.default.
*

Thanks for the explanation Martin. This strikes me as being somewhat suboptimal and not conducive to studying and understanding code. Now that I am aware of the distinction I won't be surprised when methods don't show up.

Cheers

G

> > At the time I wanted to check the development version of R as I recalled

*> > Uwe mentioning that `plot.function` was listed by `methods()` there but
**> > not in R2.13.x. I have now compiled the development version on two
**>
**> It looks like the cog that has changed between release and devel is the
**> addition of export(plot.function) and S3method(plot, "function") to the
**> NAMESPACE of graphics.
**>
**> Martin
**>
**> > Fedora installations and certain plot methods are still not being
**> > listed. Details of the exact revision of R Devel are shown at the end of
**> > this email.
**> >
**> > As an example, consider:
**> >
**> >> require(mgcv)
**> > Loading required package: mgcv
**> > This is mgcv 1.7-6. For overview type 'help("mgcv-package")'.
**> >> methods("plot")
**> > [1] plot.acf* plot.ACF* plot.augPred*
**> > [4] plot.compareFits* plot.data.frame* plot.decomposed.ts*
**> > [7] plot.default plot.dendrogram* plot.density
**> > [10] plot.ecdf plot.factor* plot.formula*
**> > [13] plot.function plot.gam plot.gls*
**> > [16] plot.hclust* plot.histogram* plot.HoltWinters*
**> > [19] plot.intervals.lmList* plot.isoreg* plot.lm
**> > [22] plot.lme* plot.lmList* plot.medpolish*
**> > [25] plot.mlm plot.nffGroupedData* plot.nfnGroupedData*
**> > [28] plot.nls* plot.nmGroupedData* plot.pdMat*
**> > [31] plot.ppr* plot.prcomp* plot.princomp*
**> > [34] plot.profile.nls* plot.ranef.lme* plot.ranef.lmList*
**> > [37] plot.shingle* plot.simulate.lme* plot.spec
**> > [40] plot.stepfun plot.stl* plot.table*
**> > [43] plot.trellis* plot.ts plot.tskernel*
**> > [46] plot.TukeyHSD plot.Variogram*
**> >
**> > Non-visible functions are asterisked
**> >
**> >> pmeth<- methods("plot")
**> >> grep("plot.mgcv.smooth", pmeth)
**> > integer(0)
**> >> getS3method("plot", "mgcv.smooth")
**> > Error in getS3method("plot", "mgcv.smooth") :
**> > S3 method 'plot.mgcv.smooth' not found
**> >> pfun<- getAnywhere("plot.mgcv.smooth")
**> >> str(pfun)
**> > List of 5
**> > $ name : chr "plot.mgcv.smooth"
**> > $ objs :List of 1
**> > ..$ :function (x, P = NULL, data = NULL, label = "", se1.mult = 1,
**> > se2.mult = 2, partial.resids = FALSE, rug = TRUE, se = TRUE,
**> > scale = -1, n = 100, n2 = 40, pers = FALSE, theta = 30, phi = 30,
**> > jit = FALSE, xlab = NULL, ylab = NULL, main = NULL, ylim = NULL,
**> > xlim = NULL, too.far = 0.1, shade = FALSE, shade.col = "gray80",
**> > shift = 0, trans = I, by.resids = FALSE, scheme = NULL, ...)
**> > $ where : chr "namespace:mgcv"
**> > $ visible: logi FALSE
**> > $ dups : logi FALSE
**> > - attr(*, "class")= chr "getAnywhere"
**> >
**> > Both `methods()` and `getS3method()` don't list/find this method, but
**> > the function exists in the mgcv name space and this method will be used
**> > via R's S3 dispatch system in `plot.gam()`.
**> >
**> > Shouldn't this method be returned by either `methods()` or
**> > `getS3method()`?
**> >
**> > TIA,
**> >
**> > Gavin
**> >
**> >> sessionInfo()
**> > R Under development (unstable) (2011-08-26 r56801)
**> > Platform: x86_64-unknown-linux-gnu (64-bit)
**> >
**> > locale:
**> > [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
**> > [3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
**> > [5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
**> > [7] LC_PAPER=C LC_NAME=C
**> > [9] LC_ADDRESS=C LC_TELEPHONE=C
**> > [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
**> >
**> > attached base packages:
**> > [1] stats graphics grDevices utils datasets methods
**> > base
**> >
**> > other attached packages:
**> > [1] mgcv_1.7-6
**> >
**> > loaded via a namespace (and not attached):
**> > [1] grid_2.14.0 lattice_0.19-33 Matrix_0.9996875-3
**> > nlme_3.1-102
**> > [5] tools_2.14.0
**>
**>
*

-- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ______________________________________________ R-devel_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-develReceived on Fri 26 Aug 2011 - 22:33:44 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

*
Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.
Archive generated by hypermail 2.2.0, at Sat 27 Aug 2011 - 10:00:25 GMT.
*

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel.
Please read the posting
guide before posting to the list.
*