r <- raster(ncol=10, nrow=10)
r <- setValues(r, 1:ncell(r))
values(r)
r <- raster(system.file("external/test.grd", package="raster"))
r <- readBlock(r, startrow=100, nrows=3, startcol=5, ncolumns=5)
values(r, format='matrix', names=TRUE)
Run the code above in your browser using DataLab