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

Dirk Eddelbuettel
Sat, 06 Jun 2020 19:51:48 -0000

On 6 June 2020 at 15:44, Duncan Murdoch wrote:
| 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 at rob:/tmp$ mkdir skeleton
| > edd at rob:/tmp$ cd skeleton/
| > edd at 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 at 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 at 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.

My bad. I usually look there first too.

In which case the change is going to stay, so my quick adjustment to Rcpp
should be fine too.

Thanks for the prompt response.

Dirk

--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org