[R-sig-Geo] More problems with sampleRandom using and extent

Ned Horning horning at amnh.org
Wed Mar 19 21:35:35 CET 2014


Hi -

I had a problem a while back using sampleRandom with an extent object to 
limit sampling within the extent and I thought it was fixed but now 
there seems to be another problem. When I run "sampleCells <- 
sampleRandom(predImage, size=20, sp=TRUE, ext=commonExt)" I get the 
following warnings and error:
--
Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
   restarting interrupted promise evaluation
2: restarting interrupted promise evaluation
3: restarting interrupted promise evaluation
Error in xmin(object) :
   error in evaluating the argument 'x' in selecting a method for 
function 'xmin': Error: object 'rr' not found
--

Below is sample code to illustrate the problem. Any idea what the 
problem might be? I'm using raster version 2.2-31 with Ubuntu 12.04.

Thanks in advance for any insight.

Ned
--
library(raster)
crs_predImage <- CRS("+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs
+ellps=WGS84 +towgs84=0,0,0")
predImage <- raster(nrows=7561, ncols=8521, xmn=240585, xmx=496215,
                     ymn=5297985, ymx=5524815)
projection(predImage) <- crs_predImage
predImage[] <- 1

commonExt <- extent(366760.6 , 425233.5, 5396052, 5450158)

sampleCells <- sampleRandom(predImage, size=20, sp=TRUE, ext=commonExt)



More information about the R-sig-Geo mailing list