rPermute: Apply a permutation to the cell values of a raster

Description Usage Arguments Value See Also Examples

View source: R/modify.operators.R

Description

The permutation of a set of cell values leads to a systematic (re)arrangement of all the members of the set.

Usage

1
rPermute(obj, type = "invert", by = NULL)

Arguments

obj

[RasterLayer(1)]
The object to modify.

type

[character(1)]
the type of permutation that should be applied. Either "invert", "revert", "descending", "ascending" or "cycle".

by

[integerish(1)]
value by which to apply the permutation; recently only for type = "cycle".

Value

A RasterLayer of the same dimensions as obj, in which all values have been permuted according to the chosen type.

See Also

Other operators to modify cell values: rBinarise, rCategorise, rDistance, rFillNA, rOffset, rRange, rSubstitute

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
input <- rtRasters$continuous

# invert background/foreground
visualise(raster::stack(input, rPermute(input)))

# sort patch values ascending
patches <- rPatches(rBinarise(input, thresh = 30))
visualise(raster::stack(patches, rPermute(patches, type = "ascending")))

# cycle values backwards by 30
visualise(raster::stack(input, rPermute(input, type = "cycle", by = -30)))

EhrmannS/rasterTools documentation built on Sept. 4, 2019, 10:34 a.m.