calc_areas {hypsoLoop} | R Documentation |
Function to calculate areas of classes within a categorical raster
Description
This function takes a categorical raster object and calculates the areas covered by each class within the raster.
Usage
calc_areas(x)
Arguments
x |
An object of class RasterLayer. |
Details
The raster package's "area()" function normally returns the same raster where cell values have been replaced by their areas in Square Km. Using this function, the values of all cells of same class are aggregated and the raster is transformed into a data frame. If the CRS of the input raster is projected, then the area is calculated by multiplying the resolution of the raster by the count of cells for each class.
Value
A data frame with one column representing the values of the classes of the raster and the other variable representing corresponding areas in Ha.
Author(s)
Faustin Gashakamba
See Also
Examples
calc_areas(lulcYanze)
[Package hypsoLoop version 0.2.0 Index]