Create a RasterBrick with a Boolean layer for each value (or subset thereof) in a RasterLayer . For example, if the cell values of a RasterLayer indicate what class they belong to (e.g. vegetation type), this function will create a layer (presence/absence) for each of these classes.
You can supply a second spatially overlapping RasterLayer with larger cells (do not use smaller cells!). In this case the cell values are counts for each class. A similar result might be obtained more efficiently by using layerize with a single RasterLayer followed by aggregate(x, , sum).
Usage
## S3 method for class 'RasterLayer,missing':
layerize(x, classes=NULL, digits=0, falseNA=FALSE, filename='', ...)
## S3 method for class 'RasterLayer,RasterLayer':
layerize(x, y, classes=NULL, digits=0, filename='', ...)
Arguments
x
RasterLayer
y
RasterLayer or missing
classes
numeric. The values for which layers should be made. If NULL all classes are used
digits
non-negative integer for rounding the cell values. Argument is passed to round
falseNA
logical. If TRUE the list will be merged in a single data.frame