[R-pkg-devel] Registered S3 methods from standard package
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Mon May 13 12:38:42 CEST 2019
On 13/05/2019 4:56 a.m., Sebastian Meyer wrote:
> I think your package can be useful. However, I'm with CRAN here in that
> I would not want my standard graphics output to be changed just because
> some package ("prettyB") gets loaded, which could happen
> *unintentionally* as a dependency (or a dependency of a dependency, ...)
> of another package.
>
> What about some kind of prettyB::enable_prettyB() function which does
>
>> registerS3method("plot", "default", prettyB::plot.default, asNamespace("graphics"))
>
> similar to delayed method registration (see, e.g.,
> https://github.com/r-lib/vctrs/blob/master/R/register-s3.R), so that a
> user needs to switch to "prettyB" graphics explicitly ?
Or more simply: call the method prettyBplot.
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
>
More information about the R-package-devel
mailing list