R: Number or rows, columns, and cells of a Raster* object

ncell {raster} | R Documentation

## Number or rows, columns, and cells of a Raster* object

### Description

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

### Usage

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

### Arguments

`x` | a Raster object
`value` | row or column number (integer > 0)

### Value

Integer

### See Also

`dim, extent`, res

### Examples

    r <- raster()
    ncell(r)
    ncol(r)
    nrow(r)
    dim(r)

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

[Package raster version 2.6-7 Index]