rCategorise: Assign categories to the values in a raster

Description Usage Arguments Details Value See Also Examples

View source: R/modify.operators.R

Description

Assign categories to the values in a raster

Usage

1
rCategorise(obj, breaks = NULL, n = NULL)

Arguments

obj

[RasterLayer(1)]
The object to modify.

breaks

[integerish(.)]
the values, where categories should be delimited.

n

[integerish(1)]
number of categories.

Details

Using n will determine breaks based on the value-range of obj so that the values are assigned to n categories.

Assigning breaks is mostly usefull when values are to be non-linear, such as log(min:max)*max/log(max), but could also be seq(min, max, length.out = 21), which corresponds to n = 20.

Value

A RasterLayer of the same dimension as obj, in which the cells have the category number into which their values fall.

See Also

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

Examples

1
2
3
4
5
6
7
8
9
input <- rtRasters$continuous
visualise(rCategorise(input, n = 5))

# use as algorithm in modify, to combine two iterations in one run
algorithm <- list(list(operator = "rCategorise", breaks = c(25, 50, 75, 90)),
                  list(operator = "rCategorise", breaks = log(1:5)*5/log(5)*20))

obj_mod <- modify(input, by = algorithm, merge = TRUE)
visualise(obj_mod)

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