Description Usage Arguments Details Value See Also Examples
View source: R/modify.operators.R
Successively combine the layers of a raster stack with each other (similar to
Reduce
).
1 2 |
obj |
[ |
by |
[ |
fun |
[ |
weights |
[ |
direction |
[ |
The argument direction
takes the direction into which the
layers should be combined. "right"
means that layers are combined
from left to right. rReduce
is based on the functional
Reduce
, where this wording is handled differently.
The number of layers in the aggregated raster depends on the length of the
list in by
. If by is left empty, everything is written into one
RasterLayer
object. Values to be aggregated in a RasterLayer
are in the same list element.
a RasterLayer
or RasterStack
of the same dimensions as
obj
, in which the layers of obj
are aggregated into a smaller
set of layers.
Other operators to modify a raster: rBlend
,
rRescale
, rSegregate
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | input <- rtRasters$continuous
patches <- rPatches(rBinarise(input, thresh = 30))
myPatches <- rSegregate(patches)
# revert the segregation
visualise(rReduce(myPatches))
# group patches
twoGroups <- list(c(1:14), c(15:28))
visualise(rReduce(myPatches, by = twoGroups))
# select a subset of patches
someLayers <- list(c(1, 3, 5, 7, 9))
visualise(rReduce(myPatches, by = someLayers))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.