[R-pkg-devel] double colon

David McPearson dmcp at webmail.co.za
Sat Feb 6 10:20:59 CET 2016


On Fri, 29 Jan 2016 17:41:40 +0100 Berry Boessenkool
<berryboessenkool at hotmail.com> wrote

> Thanks for your reply, Uwe.
> The guy yesterday very strongly suggested it for user readability, but I
> wanted to get more opinions before doing so much work. (No offense, Steven).
> 
> I'm not sure whether we talk about the same thing considering functions
> *within* the package. Say I have 'MyPackage' with 'fun_a' and also 'fun_b',
> which inside calls 'fun_a'. (Both exported) That wouldn't be in imports or
> suggests, right? 
>
> Now image by unfortunate history there is 'AnotherPackage' that also has
(its
> own and different) 'fun_a'. Is far as I remember, 'fun_b' will still call
> 'fun_a' from 'MyPackage'. I can't find back where I read that, though.
> For user readability and to be on the safe side, in the future I'll write
> 'MyPackage::fun_a'. (Of course, if I'm aware, I'll avoid same-name functions
> altogether). 
>
> kind regards,
> Berry
> 
> 
> > Subject: Re: [R-pkg-devel] double colon
<... cut for brevity...>

Indeed you appear to be correct. Have a look at
http://adv-r.had.co.nz/Environments.html#function-envs
..and a much briefer (if a little less detailed) explanation in
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Package-namespaces

+ + + + +

And Hadley, if you're reading this (if you're not I suppose it's a waste of
bandwidth):
Thanks very much for "Advanced R" It has been of immeasurable help to me.
I see you've put answers to (at least) some of the exercises. This is a good
thing. When I worked through it last I usually came up with *an* answer to one
of the exercise, but often I had little clue as to whether or not it was the
(or a) correct answer (not you're writing, my brain turned into a brick a
decade or two ago, before I'd even heard of R). So thanks also for your
continuing work, and I get to go back over it again.

Cheers all.

____________________________________________________________
South Africas premier free email service - www.webmail.co.za



More information about the R-package-devel mailing list