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

Ned Horning horning at amnh.org
Tue Mar 25 19:58:28 CET 2014


I didn't get any feedback about this issue so I am reposting the 
question. Basically I would like to know if this is indeed a bug in the 
Raster package or if it's a user problem. There is sample code at the 
bottom of the email. Any help would be appreciated.

All the best,

Ned

On 03/19/2014 04:35 PM, Ned Horning wrote:
> 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)
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>



More information about the R-sig-Geo mailing list