Extent
('bounding box')drawExtent(show=TRUE, col="red")
TRUE
, the extent will be drawn on the mapr1 <- raster(nrow=10, ncol=10)
r1[] <- runif(ncell(r1))
plot(r1)
e <- drawExtent()
# now click on the map twice
mean(values(crop(r1, drawExtent())))
# now click on the map twice
Run the code above in your browser using DataLab