View source: R/cellsFromExtent.R
cellsFromExtent | R Documentation |
cellsFromExtent returns the cell numbers for a Raster* object that are within a specfied extent (rectangular area), supply an object of class Extent, or another Raster* object.
extentFromCells returns an Extent object from a Raster* object and cell numbers. All cells are within the returned Extent.
cellsFromExtent(object, extent, expand=FALSE)
extentFromCells(object, cells)
object |
A Raster* object |
extent |
An object of class Extent (which you can create with newExtent(), or another Raster* object ) |
expand |
Logical. If |
cells |
numeric. A vector of cell numbers |
a vector of cell numbers
extent
, cellFromXY
r <- raster()
bb <- extent(-5, 5, -5, 5)
cells <- cellsFromExtent(r, bb)
r <- crop(r, bb)
values(r) <- cells
e <- extentFromCells(r, 50:55)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.