[R-pkg-devel] no visible global function definition

Duncan Murdoch murdoch.duncan at gmail.com
Mon Jun 29 19:40:50 CEST 2015


On 29/06/2015 7:09 PM, Kevin Ushey wrote:
> Hi Uwe,
> 
> It seems like this is quite a major change; I imagine it will affect many
> packages (since lots of packages implicitly assume other 'base' packages,
> like 'utils', will always be available in an R session). IIUC, in the
> latest versions of R-devel, only the 'base' package can be assumed
> available; everything else must be explicitly imported.
> 
> https://github.com/wch/r-source/commit/dba5a49dcae7e9bcb8528cf78fd9d51f092652b2
> 
> Is there any chance that such changes could be made in announcements on
> R-pkg-devel? Or, as an aside, would it be permissible for non-R-core
> members to make such announcements on this list?

It was announced in the NEWS which is online here:

http://developer.r-project.org/blosxom.cgi/R-devel/NEWS

and available as an RSS feed.  (If you prefer Twitter, feel free to
mirror the RSS feed there, if that's possible.  I don't use Twitter, so
I won't do it.)  It seems to have become known here essentially
immediately, so I'm not sure how an announcement would help.

For the reasoning:  there's been a general trend to making sure packages
work even when other packages don't use library() or require() to attach
them.  This is a logical step in that direction.  If your function foo()
uses the graphics plot() function but doesn't explicitly import it, then
your function will fail if a user tries to run it while graphics isn't
attached.  I suspect dispatch may also be faster if it is imported than
if R has to search through everything on the search list.

Duncan Murdoch

> 
> Thanks,
> Kevin
> 
> On Mon, Jun 29, 2015 at 8:46 AM, Uwe Ligges <ligges at statistik.tu-dortmund.de
>> wrote:
> 
>>
>>
>> On 29.06.2015 11:10, Daniel Lüdecke wrote:
>>
>>> Hello,
>>>
>>> I'm doing my package check for CRAN, in order to see whether submitting
>>> the
>>> package-update passes all checks.
>>> I'm doing the tests under Windows 7, using R-Version "R Under development
>>> (unstable) (2015-06-28 r68602)".
>>>
>>> Now I got a quite long list of NOTEs, which are probably no problem,
>>> however, I would like to fix these issues, if possible.
>>>
>>> It seems that all base and/or stats function now produce a note concering
>>> the visible global function definition. Here's a short example of my
>>> output
>>> from my package check:
>>>
>>> sjp.grpfrq: no visible global function definition for 'sd'
>>> sjp.grpfrq: no visible global function definition for 'plot'
>>> sjp.int: no visible global function definition for 'sd'
>>> sjp.int: no visible global function definition for 'quantile'
>>> sjp.int: no visible global function definition for 'plogis'
>>> sjp.likert: no visible global function definition for 'xtabs'
>>> sjp.likert: no visible binding for global variable 'offset'
>>> sjp.likert: no visible global function definition for 'plot'
>>> sjp.lm: no visible global function definition for 'coef'
>>> sjp.lm: no visible global function definition for 'coefficients'
>>> sjp.lm: no visible global function definition for 'confint'
>>> sjp.lm.eff: no visible global function definition for 'model.matrix'
>>>
>>> Do I have to import all these namespaces now? I'm using RStudio with
>>> roxygen, so I would add an @importFrom stats <function_x_y> where
>>> necessary
>>> - but is this the new requirement as of R >= 3.3?
>>>
>>
>> Yes. And it should have been a requirement before, I believe.
>>
>> Best,
>> Uwe Ligges
>>
>>
>>
>>
>>> Best wishes
>>> Daniel
>>>
>>>
>>>
>>>
>>> --
>>>
>>> _____________________________________________________________________
>>>
>>> Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen
>>> Rechts; Gerichtsstand: Hamburg | www.uke.de
>>> Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr.
>>> Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik
>>> _____________________________________________________________________
>>>
>>> SAVE PAPER - THINK BEFORE PRINTING
>>>
>>> ______________________________________________
>>> R-package-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>>
>>>
>> ______________________________________________
>> R-package-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>



More information about the R-package-devel mailing list