Learn R Programming

redlistr (version 1.0.1)

getAreaLoss: Area change between two inputs in km2

Description

getAreaLoss reports the difference in area between two inputs. These can be RasterLayers, SpatialPolygons, or numbers. Any combinations of these inputs are valid. If using number as input, ensure it is measured in km2

Usage

getAreaLoss(x, y)

Arguments

x

RasterLayer or SpatialPolygons object of distribution or Numeric representing area in km2

y

RasterLayer or SpatialPolygons object of distribution or Numeric representing area in km2

Value

Returns the difference in area of the two inputs in km2

See Also

Other Change functions: getArea, getDeclineStats

Examples

Run this code
# NOT RUN {
crs.UTM55S <- '+proj=utm +zone=55 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs'
r1 <- raster(ifelse((volcano<130), NA, 1), crs = crs.UTM55S)
extent(r1) <- extent(0, 6100, 0, 8700)
r2 <- raster(ifelse((volcano<145), NA, 1), crs = crs.UTM55S)
extent(r2) <- extent(0, 6100, 0, 8700)
a.dif <- getAreaLoss(r1, r2) # distribution rasters
# }

Run the code above in your browser using DataLab