crop(x, y, ...)
extent
function. New Extent objects can be also be created with link[raster]{extent}
and with drawExtent
by clicking twice on a plot.
If no filename is specified, and the resulting RasterLayer is too large to hold in memory, it is saved to a temporary file.
The following additional arguments can be passed, to replace default values for this function
filename
Output filename (can be absent for RasterLayers that can be stored in memory)
format
Character. Output file type. See writeRaster
overwrite
Logical. If TRUE
, "filename" will be overwritten if it exists
progress
Character. Valid values are "text", "tcltk", "windows" (on that platform only) and ""
}expand
, merge
r <- raster(nrow=45, ncol=90)
r[] <- 1:ncell(r)
e <- extent(-160, 10, 30, 60)
rc <- crop(r, e)
Run the code above in your browser using DataLab