[R-pkg-devel] shadowing a method from the stats package

qx@cur m@ili@g off use@st@rtm@il@com qx@cur m@ili@g off use@st@rtm@il@com
Sat Jan 12 23:01:40 CET 2019


Hi Joris,

    thank you for your reply.

    I re-read the CRAN policy after I saw your reply and you are right,
I do not need permission for this.

    About the search PATH. unifed will always be attached after stats,
so I think the unifed function would always be found before the one in
stats (please correct me if you think I am wrong).

    Still, I found a different way to solve the problem in order to
avoid NOTEs when I run 'R CMD check --as-cran', that can be considered
more robust:

    I first changed the name of my wrapper function to something
different (this is in order to avoid a note in registering S3 methods).

    then, in the zzz.R file inside of the .onLoad function I used
setMethod with where=.GlobalEnv to rewrite the summary method of the glm
class and in there I call the wrapper function.

   This gives the behavior that I wanted and it does not depend on the
search path.

Cheers,

   Oscar.

>
> Then again, I'm not sure this will always work, as you rely heavily on
> the search path for your function to be found before the one in stats.
> I would be interested as well in hearing how this can be solved in a
> more robust way, but I can't really come up with something myself.
> Interesting problem!
>
> Cheers
> Joris
>
> On Fri, Jan 11, 2019 at 10:14 PM <qxacur using use.startmail.com
> <mailto:qxacur using use.startmail.com>> wrote:
>
>     Hello,
>
>         I created a package for working with a new probability
>     distribution called unifed. The source code can be found at
>     https://gitlab.com/oquijano/unifed .
>
>         This distribution is suitable for GLMs. I have included a a
>     function called unifed in the package that returns a family that can
>     be used with the glm function.
>
>         For a unifed glm, it is necessary for the dispersion parameter to
>     be equal to one. The summary method of the glm class does this
>     automatically for the poisson and binomial distributions and I would
>     like the same for the unifed. In order to achieve this, I am
>     including a summary.glm function in the package so it shadows
>     stats::summary.glm when the package is attached. This function is
>     actually just a wrapper around stats::summary.glm.  It simply checks
>     if the family is unifed; If this is the case it calls
>     stats::summary.glm with dispersion=1 and otherwise it simply calls
>     stats::summary.glm with the same parameters.  Therefore introducing
>     this in the namespace does not break or change the behavior of any
>     existing code that uses summary.glm
>
>          According to the CRAN policies I need permission from the
>     maintainer of the package for doing this. The maintainer of the
>     package
>     is the R core team. To whom should I write to ask for this permission?
>     Otherwise is there a different way in which I could achieve the right
>     default behavior and respect the CRAN policies?
>
>
>     Thank you for your time.
>
>     ______________________________________________
>     R-package-devel using r-project.org
>     <mailto:R-package-devel using r-project.org> mailing list
>     https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
>
>
> -- 
> Joris Meys
> Statistical consultant
>
> Department of Data Analysis and Mathematical Modelling
> Ghent University
> Coupure Links 653, B-9000 Gent (Belgium)
> <https://maps.google.com/?q=Coupure+links+653,%C2%A0B-9000+Gent,%C2%A0Belgium&entry=gmail&source=g>
>
> tel: +32 (0)9 264 61 79
> -----------
> Biowiskundedagen 2017-2018
> http://www.biowiskundedagen.ugent.be/
>
> -------------------------------
> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list