[Rd] R CMD check --as-cran does not show all error messages.

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Sep 5 11:03:31 CEST 2014


On 05/09/2014 08:04, Mikko Korpela wrote:
> On 04.09.2014 18:15, Thalles wrote:
>
>> I am writing a package with some R functions and try to submit it to CRAN.
>> After build and check the package a number of times, I am struggling with
>> the fact that the CRAN people responsible for checking  packages are
>> replying me with some mistakes that I just do NOT get when I do the check in
>> my computer. With the most recent R version, i.e. 3.1.1 and the command R
>> CMD check --as-cran on my package I get:
>
> (check log with no errors)
>
>> However, the people from CRAN claim that there is a error:
>>
>> * checking R code for possible problems ... NOTE
>> PlotBgMap: no visible binding for global variable ‘canada.map’
>>
>> This function 'PlotBgMap' loads this data set ‘canada.map’, that is part of
>> the package. And the *LazyData: yes* is set in the DESCRIPTION file. I know
>> that the cause of this error is because somehow, the package is not being
>> loaded in the NAMESPACE, but it should be there because I am using LazyData.
>> That is the code for the PlotBgMap function:
>>
>> PlotBgMap <-function( traj, ... ) {
>>      hySplitProj <- CRS(proj4string(traj))
>>      canada <- spTransform(canada.map, hySplitProj)
>>      plot(canada.map, border="white", col="lightgrey", ... )
>> }
>>
>> I'd like to know if I am missing something in the Checking process, or if I
>> should do anything else to fix this error. Thanks.
>
> It seems that this is the same issue as discussed recently on this
> mailing list, with the title "no visible binding for global variable for
> data sets in a package". I recommend reading the message thread.
>
> Short story: There was a recent change to package checking in the
> development version of R (R-devel). This more rigorous check is not
> included in the current release version 3.1.1. You can use
> opentraj::canada.map to access this particular data set, and a similar
> approach for any other LazyData in your package. The :: technique was
> suggested in the aforementioned message thread by professors Brian D.
> Ripley and Peter Dalgaard.
>
> Quoting "Changes in R-devel",
> http://stat.ethz.ch/R-manual/R-devel/doc/html/NEWS.html
>
>> R CMD check now by default checks code usage directly on the package
>> namespace without loading and attaching the package and its suggests
>> and enhances. For good practice with packages in the Suggests field,
>> see §1.1.3.1 of ‘Writing R Extensions‘.
>
> The CRAN Repository Policy,
> http://cran.r-project.org/web/packages/policies.html, suggests using the
> most recent R-devel for package checking before submission.

It more than 'suggests':

'This should be done with the current version of R-devel ...'

That was pointed out to the original poster (multiple times) by the CRAN 
team.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK



More information about the R-devel mailing list