[R-sig-Geo] Possible proj.4-related error coming when specifying CRS for raster

Roger Bivand Roger@B|v@nd @end|ng |rom nhh@no
Fri Apr 26 15:00:04 CEST 2019


On Fri, 26 Apr 2019, Alex Zvoleff via R-sig-Geo wrote:

> 
> Hi all,
> 
>  
> 
> Recently the glcm package I maintain has started throwing errors on all of
> the Linux-based CRAN test servers. The errors come when checking the
> examples included in the package. I have not been able to reproduce these
> errors locally on Linux (Ubuntu 18.04 running r-release and r-devel) or on
> Windows 10 (r-release and r-devel). The errors also don’t come up on any of
> the r-hub servers.
> 
>  
> 
> Here is an example error from the CRAN test server:
> 
>  
> 
> > require(raster)
> 
> Loading required package: raster
> 
> Loading required package: sp
> 
> > set.seed(0)
> 
> > test_matrix <- matrix(runif(100)*32, nrow=10)
> 
> > test_raster <- raster(test_matrix, crs='+init=EPSG:4326')

"EPSG" must be "epsg"; after making two such changes, I see:

* checking examples ... OK
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
   Running ‘test-all.R’
  ERROR
Running the tests in ‘tests/test-all.R’ failed.
Last 13 lines of output:
          crs = crs, ...)
   12: raster(xmn = x using xmin, xmx = x using xmax, ymn = x using ymin, ymx = x using ymax, ncols 
= ncols, nrows = nrows,
          crs = crs, ...)
   13: .local(...)
   14: CRS(as.character(projection(crs)))
   15: stop(res[[2]])

   ══ testthat results 
═══════════════════════════════════════════════════════════
   OK: 1 SKIPPED: 0 WARNINGS: 0 FAILED: 3
   1. Error: glcm on 3x3 window with 1x1 shift works (@test-glcm.R#21)
   2. Error: glcm on 5x7 window with 2x3 shift works (@test-glcm.R#48)
   3. Error: (unknown) (@test-glcm.R#113)

   Error: testthat unit tests failed
   Execution halted

but myself never use testthat because it always hides the actual errors. 
Your use of roxygen may well also be concealing verbatim "EPSG", which may 
be in the stored data objects in glcm/data:

> crs(get(load(list.files()[5]))
CRS arguments: +init=EPSG:4326

So a leftover from the previously tolerated use of "EPSG" for "epsg", I 
think.

crs(test_raster) <- "+init=epsg:4326"
save(test_raster, file="test_raster.RData")

gives:

* checking examples ... OK
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
   Running ‘test-all.R’
  OK

Roger

> 
> Error in CRS(as.character(projection(crs))) :
> 
>   no arguments in initialization list
> 
> Calls: raster ... raster -> .local -> raster -> raster -> .local -> CRS
> 
> Execution halted
> 
>  
> 
> (full output here:https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-clang/g
> lcm-00check.html)
> 
>  
> 
> The CRAN maintainers suggested I run R CMD check with
> _R_CHECK_SUGGESTS_ONLY_=FALSE, but that hasn’t worked – even when the env
> variable is set I still don’t see the error on my end. Given that, they
> suggested I reach out here. From the error message I assume the error is
> something related to proj.4 not being able to interpret the EPSG code
> (though this would seem odd for 4326). I have tested this locally on proj.4
> versions 4.9.3 and 5.2.0, but I can’t reproduce the error I am getting from
> the CRAN server on either version. Has anyone else encountered something
> like this? If not, any idea whether I am on the right track?
> 
>  
> 
> Thanks,
> 
> Alex
> 
>  
> 
> --
> 
> Alex Zvoleff, PhD
> Senior Director, Resilience Science
> Betty and Gordon Moore Center for Science
> Conservation International
> 2011 Crystal Dr. Suite 500, Arlington, Virginia 22202, USA
> Tel: +1-703-341-2749, Skype: azvoleff, http://www.conservation.org
> 
>  
> 
> 
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en


More information about the R-sig-Geo mailing list