dimensions: Dimensions of a Raster* object

Description Usage Arguments Value See Also Examples

Description

Get or set the number of rows, columns, and layers of a Raster* object. You cannot use this function to set the dimensions of a RasterStack object.

When setting the dimensions, you can provide a row number, or a vector with the row and the column number (for a RasterLayer and a RasterBrick), or a row and column number and the number of layers (only for a RasterBrick)

Usage

1
2
## S4 method for signature 'BasicRaster'
dim(x)

Arguments

x

Raster(* object

Value

Integer or Raster* object

See Also

ncell, extent, res

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
r <- raster()
dim(r)
dim(r) <- c(18) 
dim(r)
dim(r) <- c(18, 36) 
dim(r)
b <- brick(r)
dim(b)
dim(b) <- c(10, 10, 5)
dim(b)

Example output

Loading required package: sp
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
[1] 180 360   1
[1]  18 360   1
[1] 18 36  1
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
[1] 18 36  1
[1] 10 10  5

raster documentation built on Jan. 5, 2021, 3:01 a.m.