Learn R Programming

APAtree (version 1.0.1)

set_raster_values: Replacement of non-NA values of a raster

Description

Takes raster* objects as input and replaces all non-NA values with values specified in a data.frame. Multiple columns will return RasterStack's.

Usage

set_raster_values(raster, data)

Arguments

raster

A raster* object. All non-NA values of raster will be replaced. If raster is a RasterStack, each layer has to have identical na-cells.

data

A data.frame with as many rows as there are non-NA values in raster.

Value

A RasterLayer if data has only one column. A RasterBrick if multiple columns were specified in data. Character and factor data will lead to the creation of factor layers.