Description Usage Arguments Value See Also Examples
View source: R/modify.operators.R
Distinct values in a raster will be assigned to layers in a raster stack.
1 | rSegregate(obj, by = NULL, flatten = FALSE, background = NULL)
|
obj |
[ |
by |
[ |
flatten |
[ |
background |
[ |
a RasterStack
of the same dimensions as obj
, in which
the elements specified in by
or the distinct values of obj
have each been assigned to a seperate layer.
Other operators to modify a raster: rBlend
,
rReduce
, rRescale
1 2 3 4 5 6 7 8 9 10 11 12 | input <- rtRasters$continuous
patches <- rPatches(rBinarise(input, thresh = 30), background = 0)
myPatches <- rSegregate(patches)
visualise(myPatches[[c(2, 3, 12, 16)]])
# when flattening, all values are set to 1
myPatches2 <- rSegregate(patches, flatten = TRUE)
visualise(myPatches2[[c(2, 3, 12, 16)]])
# cut out by 'patches'
patchValues <- rSegregate(input, by = patches)
visualise(patchValues[[c(2, 3, 12, 16)]])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.