# extent

0th

Percentile

##### Extent

This function returns an Extent object of a Raster* or Spatial* object (or an Extent object), or creates an Extent object from a 2x2 matrix (first row: xmin, xmax; second row: ymin, ymax), vector (length=4; order= xmin, xmax, ymin, ymax) or list (with at least two elements, with names 'x' and 'y')

bbox returns a sp package like 'bbox' object (a matrix)

Keywords
spatial
##### Usage
extent(x, ...)
##### Arguments
x

Raster* or Extent object, a matrix, or a vector of four numbers

...

Additional arguments. When x is a single number representing 'xmin', you can pass three additional numbers (xmax, ymin, ymax)

When x is a Raster* object, you can pass four additional arguments to crop the extent: r1, r2, c1, c2, representing the first and last row and column number

##### Value

Extent object

extent, drawExtent

##### Aliases
• extent
• extent,Extent-method
• extent,BasicRaster-method
• extent,Spatial-method
• extent,sf-method
• extent,matrix-method
• extent,numeric-method
• extent,list-method
• extent,GridTopology-method
• bbox,Raster-method
• bbox,Extent-method
##### Examples
library(raster) # NOT RUN { r <- raster() extent(r) extent(c(0, 20, 0, 20)) #is equivalent to extent(0, 20, 0, 20) extent(matrix(c(0, 0, 20, 20), nrow=2)) x <- list(x=c(0,1,2), y=c(-3,5)) extent(x) #crop the extent by row and column numbers extent(r, 1, 20, 10, 30) # } 
Documentation reproduced from package raster, version 2.6-7, License: GPL (>= 3)

### Community examples

Looks like there are no examples yet.