[R-pkg-devel] Registered S3 methods from standard package

Georgi Boshnakov georg|@bo@hn@kov @end|ng |rom m@nche@ter@@c@uk
Mon May 13 09:57:11 CEST 2019


> 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.

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().


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:

https://github.com/jumpingrivers/prettyB/

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:

https://github.com/jumpingrivers/prettyB/blob/master/R/plot.R#L23

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?

Thanks

Colin

______________________________________________
R-package-devel using r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list