[Rd] odd NOTE in R CMD check of data; Rcpp module related

Robert J. Hijmans r@hijm@n@ @ending from gm@il@com
Sat Nov 3 18:29:35 CET 2018


With the current version of the "raster" package (that I maintain), R CMD
check on packages "soilDB" and "PopGenReport" have this NOTE:

Package: soilDB
Check: data for non-ASCII characters
New result: NOTE
    Error in .requirePackage(package) :
      unable to find required package 'raster'
    Calls: <Anonymous> ... .findInheritedMethods -> getClass -> getClassDef
-> .requirePackage
    Execution halted


In soiDB this is presumably triggered by loading this file:

> f <- system.file("data/gSSURGO.chunk.rda", package="soilDB")
> "raster" %in% .packages()
[1] FALSE
> load(f)
> gSSURGO.chunk
Loading required package: raster
Loading required package: sp
Error: package or namespace load failed for ‘raster’ in
.doLoadActions(where, attach):
 error in load action .__A__.1 for package raster: loadModule(module =
"spmod", what = TRUE, env = ns, loadNow = TRUE): Unable to load module
"spmod": object of type 'closure' is not subsettable
Error in .requirePackage(package) :
  unable to find required package ‘raster’

# but all is OK the second time around

> gSSURGO.chunk
class       : RasterLayer
dimensions  : 106, 137, 14522  (nrow, ncol, ncell)
resolution  : 4, 4  (x, y)

The error message suggests that something goes wrong with the Rcpp module
that raster is using. The module was newly introduced, and coincides with
this new behavior. Do you have any idea about what I could do to avoid this?

This behavior can be simply simulated by creating a new RasterLayer, saving
it, and loading it in a fresh session.

library(raster)
x <- raster(ncol=10, nrow=10, vals=1:100)
saveRDS(x, "x.rds")
--- new R session ---
readRDS("x.rds")
readRDS("x.rds")

This gives

> readRDS("x.rds")
Loading required package: raster
Loading required package: sp
Error: package or namespace load failed for ‘raster’ in
.doLoadActions(where, attach):
 error in load action .__A__.1 for package raster: loadModule(module =
"spmod", what = TRUE, env = ns, loadNow = TRUE): Unable to load module
"spmod": object of type 'closure' is not subsettable
Error in .requirePackage(package) :
  unable to find required package ‘raster’

> readRDS("x.rds")
class       : RasterLayer
dimensions  : 10, 10, 100  (nrow, ncol, ncell)
resolution  : 36, 18  (x, y)
extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source : in memory
names       : layer
values      : 1, 100  (min, max)

Any idea about what I can do to get rid of this?

Thanks,
Robert Hijmans

	[[alternative HTML version deleted]]



More information about the R-devel mailing list