[Rd] package check note: no visible global function definition (in functions using Tcl/Tk)

Jari Oksanen jarioksa at sun3.oulu.fi
Tue Jun 12 11:56:25 CEST 2007

On Tue, 2007-06-12 at 00:42 +0200, Henrik Bengtsson wrote:
> On 6/11/07, Seth Falcon <sfalcon at fhcrc.org> wrote:
> > Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
> >
> > > It seems that is happens if package tcltk is missing from the Depends:
> > > list in the DESCRIPTION file.  I just tested with Amelia and homals and
> > > that solved the various warnings in both cases.
> >
> > Adding tcltk to Depends may not always be the desried solution.  If
> > tcltk is already in Suggests, for example, and the intention is to
> > optionally provide GUI features, then the code may be correct as-is.
> > That is, codetools will issue the NOTEs if you have a function that
> > looks like:
> >
> >    f <- function() {
> >      if (require("tckltk")) {
> >              someTckltkFunctionHere()
> >      } else
> >              otherwiseFunction()
> >      }
> >    }
> >
> > There are a number of packages in the BioC repository that provide
> > such optional features (not just for tcltk) and it would be nice to
> > have a way of declaring the use such that the NOTE is silenced.
> Same scenario here: I am using Suggest and I found that the NOTEs go
> away if you call the function with double-colon (::), e.g.
> tcltk::someTckltkFunctionHere().
> I also got several NOTEs about non-declared objects if I used
> request(<pkgname>), but they go away with request("<pkgname>").
The real problem here is what are the consequences for CRAN auditing
with the new defaults. Do you have to pass these tests also? Do you
implement stricter package dependence checking? Do you still allow the
check circumvention device that Henrik, perhaps unwisely, revealed here
(that is package::function)? 

Just being curious, I run checkUsagePackage() for my CRAN package
(vegan), and got 109 messages. 58 of these were "local variables
assigned but may not be used" and need be checked. My first impression
was that they were just harmless leftover, and removing those is not
among my top priorities, but may wait till September. Some were false
positives. Most of the rest (49 + 1 special case) were calls to
functions in other packages with require || stop in the function body.
I'd like to keep them like this, or at least with the circumvention
device. Please don't make this test a requirement in CRAN submissions!

One real error was detected also, but fixing that error broke the
function, since the rest of the function already was expecting erroneous
output to work correctly. 

I urge for more relaxed dependence checking allowing calls to other
packages in functions. I've been a Linux user since Red Hat 5.1 and I
know what is a dependence hell (package depending on package
depending ... depending on broken package). There already are some signs
of that in R, in particular in unsupported platforms like MacOS 10.3.9
where I have trouble in installing some packages that depend on
packages... (if somebody wonders why I still use MacOS 10.3.9, I can
give 129 reasons, each worth one Euro). 

cheers, Jari Oksanen

More information about the R-devel mailing list