[R-pkg-devel] Registered S3 methods from standard package
c@g|||e@p|e @end|ng |rom gm@||@com
Mon May 13 10:05:21 CEST 2019
> Have you checked that this actually works? Many base R functions do some preparation and call directly plot.default(), so they both bypass the method and see graphics::plot.default, not yours, see e.g. plot.ts().
It doesn't work for all plot.XXX for the reasons you describe. But my
use case was a bit more modest than that, I just want to make the
standard plotting functions for numeric data a bit nicer.
plot(rnorm(10), rnorm(10), xlab ="x", main = "A title")
But, if a function just calls `plot()` again, everything works, e.g.
plot.lm is fine
plot(lm(1:10 ~ rnorm(10)), which = 1)
> Georgi Boshnakov
> -----Original Message-----
> From: R-package-devel [mailto:r-package-devel-bounces using r-project.org] On Behalf Of Colin Gillespie
> Sent: 13 May 2019 08:22
> To: r-package-devel using r-project.org
> Subject: [R-pkg-devel] Registered S3 methods from standard package
> Dear All,
> I'm developing a small package to make plotting methods a little bit
> nicer looking:
> The general idea is to replace plot.default() with an alternative
> (matching all arguments) and export. This would allow users to simply
> load the package and use base graphics functions as normal, but get a
> pretty graph.
> The general pattern I follow is:
> which then includes S3method(plot,default) in my NAMESPACE file. When
> building and checking the package I get
> Registered S3 methods from standard package(s) overwritten by 'prettyB':
> method from
> plot.default graphics
> which CRAN does not permit.
> Question: Is it possible to achieve the functionality I'm after
> (replacing the default plot.default() functions) while following the
> CRAN rules?
> R-package-devel using r-project.org mailing list
More information about the R-package-devel