[<-,VirtualArray,ANY,ANY,logical-method {via} | R Documentation |
Replace layers in an object that is of a class derived from 'VirtualArray
'.
Description
Single bracket '['
refers to indices and names within the 'VirtualArray
'-class object. Use double brackets to replace layers based on their names (in the @stack
).
Object types of the same kind class can be used to replace values in 'XArray
'-class objects. 'SpatRaster
'-class objects can be used to replace values in 'RasterArray
'-class objects. Classes inheriting from 'sf
' can be used with 'SfArray
'-class objects.
Usage
## S4 replacement method for signature 'VirtualArray,ANY,ANY,logical'
x[i, j, ...] <- value
## S4 replacement method for signature 'RasterArray,ANY,ANY,SpatRaster'
x[i, j, ...] <- value
## S4 replacement method for signature 'SfcArray,ANY,ANY,sfc'
x[i, j, ...] <- value
## S4 replacement method for signature 'SfArray,ANY,ANY,sf'
x[i, j, ...] <- value
Arguments
x |
|
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 |
Value
The function has no return value.
Examples
ex <- rastex()
# replace third element with missing value
ex[3] <- NA
# duplicate first element and make it the second too
ex[2] <- ex[1]
ex
[Package via version 0.2.0 Index]