Get the number of rows, columns, or cells of a Raster* object.

ncol(x)
nrow(x)
ncell(x)
ncol(x, ...) <- value
nrow(x, ...) <- value

Arguments

x

a Raster object

value

row or column number (integer > 0)

...

additional arguments. None implemented

Value

Integer

See also

Examples

r <- raster()
ncell(r)
#> [1] 64800
ncol(r)
#> [1] 360
nrow(r)
#> [1] 180
dim(r)
#> [1] 180 360   1

nrow(r) <- 18
ncol(r) <- 36
# equivalent to
dim(r) <- c(18, 36)