getAreaChange reports the difference in area between two inputs. Inputs
can be SpatRaster, SpatVector, sf or a data frame of areas and may contain
data for multiple ecosystem types. Ensure x and y are the same data type.
If using data frame as input, ensure areas are measured in km2
Arguments
- x
SpatRaster, SpatVector, or sf object representing one or more ecosystems or a data frame with two columns, one of them labeled "area", and the other containing ecosystem labels names_from_x.
- y
SpatRaster, SpatVector, or sf object representing one or more ecosystems or a data frame with two columns, one of them labeled "area", and the other containing ecosystem labels names_from_y.
- names_from_x
name of column containing ecosystem labels. Ignored if x is a raster.
- names_from_y
name of column containing ecosystem labels. Ignored if y is a raster. names_from_x used if not provided.
Value
Returns a table containing ecosystem labels, areas, and the difference in area of the two inputs in km2
See also
Other Change functions:
getArea(),
getAreaTrend(),
getDeclineStats()
Author
Nicholas Murray murr.nick@gmail.com, Calvin Lee calvinkflee@gmail.com, Aniko B. Toth anikobtoth@gmail.com
Examples
m1 <- matrix(sample(1:4, 500, replace = TRUE, prob = c(4,1,1,6)), nrow=25, ncol=20)
r1 <- terra::rast(m1, crs = "EPSG:32755")
m2 <- matrix(sample(1:4, 500, replace = TRUE, prob = c(4,1,1,6)), nrow=25, ncol=20)
r2 <- terra::rast(m2, crs = "EPSG:32755")
a.dif <- getAreaChange(r1, r2) # distribution rasters
