Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

replacementSingle

Replace layers of a RasterArray or SpatialArray object


Description

Single bracket '[' refers to indices and names within the \codeRasterArray or SpatialArray. Use double brackets to replace layers based on their names (in the stack). RasterLayers and RasterArray entries can be used to replace values in RasterArrays. Spatial* objects and SpatialArrays can be used with SpatialArrays.

Usage

## S4 replacement method for signature 'XArray,ANY,ANY,logical'
x[i, j, ...] <- value

## S4 replacement method for signature 'RasterArray,ANY,ANY,RasterLayer'
x[i, j, ...] <- value

## S4 replacement method for signature 'SpatialArray,ANY,ANY,SpatialPoints'
x[i, j, ...] <- value

## S4 replacement method for signature 'SpatialArray,ANY,ANY,SpatialPointsDataFrame'
x[i, j, ...] <- value

## S4 replacement method for signature 'SpatialArray,ANY,ANY,SpatialLines'
x[i, j, ...] <- value

## S4 replacement method for signature 'SpatialArray,ANY,ANY,SpatialLinesDataFrame'
x[i, j, ...] <- value

## S4 replacement method for signature 'SpatialArray,ANY,ANY,SpatialPolygons'
x[i, j, ...] <- value

## S4 replacement method for signature 'SpatialArray,ANY,ANY,SpatialPolygonsDataFrame'
x[i, j, ...] <- value

Arguments

x

RasterArray or SpatialArray object.

i

subscript of the first dimension(rows) or vector-like subsetting.

j

subscript of the second dimension (columns).

...

subscript of additional dimensions.

value

A same class object as x.

Value

None.

Examples

data(dems)
# replace third element with missing value
dems[3] <- NA
# duplicate first element and make it the second too
dems[2] <-dems[1]

chronosphere

Earth System History Variables

v0.4.1
CC BY 4.0
Authors
Adam T. Kocsis, Nussaibah B. Raja
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.