[R] Masked from package

Duncan Murdoch murdoch.duncan at gmail.com
Thu Sep 25 18:37:32 CEST 2014


On 25/09/2014 11:46 AM, Jeff Newmiller wrote:
> No, masking does not imply inheritance. Simply that "foo" now refers to a different function, so you have to use "oldpkg::foo" if you want to get at the old function from your normal working environment.

I haven't read the book (?), but I'd guess what they refer to is the way 
that package uses masking, rather than a claim about masking in general.

The cor() function in base R isn't a generic function, but it is masked 
by one in the compositions package, which provides a variety of methods 
for it.  The default method calls the stats::cor function.  So in that 
sense it really does provide a kind of inheritance.

Duncan Murdoch

>
> Note that packages that call "foo" will continue to find the versions they intended to call if they are constructed correctly.
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>                                        Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.
>
> On September 25, 2014 8:19:14 AM PDT, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> >On Thu, 25 Sep 2014, MacQueen, Don wrote:
> >
> >> And to answer the “What do I read ...?” question
> >>  help.search('masked’)
> >> returns quite a few things on my system, and the one you want is
> >
> >Don, et al.:
> >
> >   Further research led me to re-read the beginning of "Analyzing
> >Compositional Data with R" where the authors describe the masking as
> >analgous (my interpretation) to instatiating an object as in Python or
> >wxPython. With the package compositions, there are functions with the
> >same
> >name as functions in other packages. The compositions package extends
> >functionality and implies that the parent functionality is inherited,
> >not
> >replaced.
> >
> >   Perhaps this is the norm for all R packages.
> >
> >Thanks very much to all,
> >
> >Rich
> >
> >______________________________________________
> >R-help at r-project.org mailing list
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide
> >http://www.R-project.org/posting-guide.html
> >and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list