matrixToRaster: Creates a RasterLayer object from a matrix

View source: R/matrixToRaster.R

matrixToRasterR Documentation

Creates a RasterLayer object from a matrix

Description

Transforms a matrix into a RasterLayer object.

Usage

matrixToRaster(matrix, raster = NULL, projection = NULL)

Arguments

matrix

a matrix object. See Details.

raster

a RasterLayer object whose extent and projection are used to create a raster from matrix.

projection

a character vector providing a coordinate reference system. Required when ncol(matrix)=3.

Details

When ncol(matrix)=3, this function assumes that the first two columns of argument matrix provide coordinates to create a RasterLayer, hence argument projection must be provided. When argument matrix has only 2 columns, then the argument raster must be provided because its coordinates and projection will be used to rasterize matrix.

Value

A RasterLayer

Note

In previous versions, raster argument was written in capital letters.

See Also

Raster-class


geoTS documentation built on Nov. 18, 2022, 1:08 a.m.