[R-pkg-devel] Registered S3 methods from standard package
Colin Gillespie
c@g|||e@p|e @end|ng |rom gm@||@com
Thu May 16 09:08:06 CEST 2019
Hi All,
Just to close the thread for future readers.
CRAN forbid both plot.numeric() and plot.default(). Instead, I should
go down the route of pretty_plot and plot.prettyB
This means that plot(lm(1:10 ~ rnorm(10)) doesn't work and the plot()
function doesn't magically become nicer.
__But__ I do appreciate that overwriting plot.default() may cause
chaos for other package authors, so overall it's probably the correct
choice.
Thanks
colin
On Mon, 13 May 2019 at 12:26, Colin Gillespie <csgillespie using gmail.com> wrote:
>
> Dr Colin Gillespie
>
> >
> > Or more simply: call the method prettyBplot.
>
> Rightly (but perhaps wrongly) I was trying for a simple method where
> the plots just change. If prettyB loaded, the plots just look a little
> nicer. If prettyB isn't available, then the plot function works as normal.
>
> So two possible options are:
>
> * registerS3method - I suspect this isn't permitted.
> * Don't override plot.default(), but override other methods. E.g.
> boxplot.list() and plot.numeric(). But is this going against the
> spirit of the law?
>
> Thanks
>
> Colin
>
> >
> > Duncan Murdoch
> >
> > >
> > > Resetting to graphics::plot.default should be made possible as well.
> > >
> > > The question remains whether registerS3method() can be used at all,
> > > since the help says:
> > >
> > >> Internal namespace support functions. Not intended to be called
> > >> directly, and only visible because of the special nature of the
> > >> ‘base’ namespace.
> > >
> > > Cheers,
> > >
> > > Sebastian
> > >
> > >
> > > Am 13.05.19 um 09:22 schrieb Colin Gillespie:
> > >> 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
> > >>
> > >
> > > ______________________________________________
> > > R-package-devel using r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-package-devel
> > >
> >
> > ______________________________________________
> > 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