r <- raster(system.file("external/test.grd", package="raster"))
b <- getValuesBlock(r, row=100, nrows=3, col=10, ncols=5)
b
dim(b) = c(3,5)
b
e = extent(180078, 180251, 330247, 330433)
getValuesExtent(r, e)
Run the code above in your browser using DataLab