[Rd] Change in package.skeleton behavior from R 3.6.3 to R 4.0.0 ?

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Sat Jun 6 21:44:29 CEST 2020


On 06/06/2020 3:06 p.m., Dirk Eddelbuettel wrote:
> 
> The Rcpp package and some related packages such as RcppArmadillo make use of
> (local) wrappers around the utils::package.skeleton() function for creating
> (basic yet functional) packages using Rcpp or RcppArmadillo. RStudio also
> exposes this under the graphical menu as a nice way to construct a package.
> 
> But it seems that something changed quite recently in R. I looked into this a
> little yesterday and prepared a workaround for Rcpp; Kevin (CC'ed) was more
> diligent and found what changed with R itself. See the discussion under issue
> ticket #1087 at the Rcpp repo: https://github.com/RcppCore/Rcpp/issues/1087
> The proposed simple PR is at https://github.com/RcppCore/Rcpp/pull/1088
> 
> As Kevin mentions in #1087, R itself may have changed, and he even dug up a
> possible commit [1]. One can illustrate that quickly with two different R
> interpreters, I use Docker here because that's what I often do. I apologise
> for the long command-line; that is basically just common Docker arguments.
> The keys are r-base:3.6.3 and r-base:4.0.0 for selecting the relevant R
> builds, and the command string passed to bash to call Rscript and
> package.skeleton() followed by a cat of the NAMESPACE file.
> 
> -----------------------------------------------------------------------------
> edd using rob:/tmp$ mkdir skeleton
> edd using rob:/tmp$ cd skeleton/
> edd using rob:/tmp/skeleton$ docker run --rm -ti -u1000:1000 -v ${PWD}:/mnt -w /mnt r-base:3.6.3 bash -c "Rscript -e 'x <-1L; package.skeleton(name=\"p363\")'; cat p363/NAMESPACE"
> Creating directories ...
> Creating DESCRIPTION ...
> Creating NAMESPACE ...
> Creating Read-and-delete-me ...
> Saving functions and data ...
> Making help files ...
> Done.
> Further steps are described in './p363/Read-and-delete-me'.
> exportPattern("^[[:alpha:]]+")
> edd using rob:/tmp/skeleton$ docker run --rm -ti -u1000:1000 -v ${PWD}:/mnt -w /mnt r-base:4.0.0 bash -c "Rscript -e 'x <-1L; package.skeleton(name=\"p400\")'; cat p400/NAMESPACE"
> Creating directories ...
> Creating DESCRIPTION ...
> Creating NAMESPACE ...
> Creating Read-and-delete-me ...
> Saving functions and data ...
> Making help files ...
> Done.
> Further steps are described in './p400/Read-and-delete-me'.
> export("x")
> edd using rob:/tmp/skeleton$
> -----------------------------------------------------------------------------
> 
> In short, 4.0.0 no longer exports via 'exportPattern("^[[:alpha:]]+")'
> rendering the new package created non-functional.
> 
> Was this intentional, or is this a bug we can look into fixing for R 4.0.2 ?

It's in the NEWS, so I'd assume it was intentional:

  - package.skeleton() now explicitly lists all exports in the 
‘NAMESPACE’ file.

An earlier version of that message even showed up in the link you posted.

Duncan Murdoch

> 
> Dirk
> 
> 
> [1] This uses the GitHub mirror rather than svn but the underlying code is of
> course the same
> https://github.com/wch/r-source/commit/36b27d951fb355f268191a25909ab292a273932d#diff-a1b94fcea8b8818d4371aabf04dc2b3c
>



More information about the R-devel mailing list