[Rd] legitimate use of :::

John Fox jfox at mcmaster.ca
Thu Aug 22 22:42:01 CEST 2013


Dear Michael and Uwe,

> -----Original Message-----
> From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-
> project.org] On Behalf Of Michael Friendly
> Sent: Thursday, August 22, 2013 2:57 PM
> To: Uwe Ligges
> Cc: R-devel
> Subject: Re: [Rd] legitimate use of :::
> 
> On 8/22/2013 7:45 AM, Uwe Ligges wrote:
> >
> >
> > On 22.08.2013 07:45, Yihui Xie wrote:
> >> Hi,
> >>
> >> So now R CMD check starts to warn against :::, but I believe
> sometimes
> >> it is legitimate to use it when developing R packages. For example,
> I
> >> have some utils functions that are not exported but I want to share
> >> them across the packages that I maintain. I do not need to
> coordinate
> >> with other authors about these internal functions since I'm the only
> >> author and I know clearly what I'm doing, and I want to avoid
> copying
> >> and pasting the code across packages just to avoid the NOTE in R CMD
> >> check. What should I do in this case?
> >
> > Nothing. The way you describe above seems to be a reasonable usage,
> iff
> > you are the same maintainer who knows what is going on. Other
> > maintainers should not use one of your not exported (hence non API)
> > functions, of course.
> >
> > Uwe Ligges
> >
> >
> 
> Related to this is the use of other-package unexported utility
> functions
> that don't pass Uwe's iff test, but I, as maintainer,
> want to use in my package.
> 
> Cases in point:  in heplots, I had used stats:::Pillai, stats:::Wilks,
> stats:::Roy and stats:::LH for calculation in one of my functions.
> Similarly, I had a need to use car:::df.terms, also unexported, but
> don't want to ask John Fox to export it just for my use.  Uwe's
> reply suggests that I should not be using car:::df.terms, however.
> 
> To avoid the NOTEs (which often triggers a 'pls fix' upon submission to
> CRAN), I simply copied/pasted these functions to my package, but this
> seems wasteful.

I think that the ideal solution is for everyone to export functions that
somewhat else might want, but it's hard to anticipate what these are, and it
would be useful then to differentiate functions that are meant for "end"
users from those meant for developers. Maybe packages could document the
latter in something like a Utilities.Rd file. Probably there's a better,
more formal, solution.

The stats:::Pillai, Wilks, HL, and Roy functions seem reasonable candidates
for export -- I too use these functions, in the car package, and have
resorted to the fix that Michael adopted. I'd be happy to export df.terms,
but would rather segregate it from end-user functions.

It's also clear to me that enforcing namespace conventions more
consistently, which is certainly desirable in the abstract, opens a can of
worms, especially for the CRAN administrators. One hopes that we'll all
survive the process and will have better packages in the end.

My two cents.

John

> 
> -Michael
> 
> 
> --
> Michael Friendly     Email: friendly AT yorku DOT ca
> Professor, Psychology Dept. & Chair, Quantitative Methods
> York University      Voice: 416 736-2100 x66249 Fax: 416 736-5814
> 4700 Keele Street    Web:   http://www.datavis.ca
> Toronto, ONT  M3J 1P3 CANADA
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list