This algorithm is able to obtain gain and loss in the land cover classification.
coverChange(x, y)
A list with loss raster, gain raster, loss hectares and gain hectares.
It is important to mention that the images used to obtain gain and loss in land cover classification must have the same extent. It is preferable that the classified images come from the same software.
library(ForesToolboxRS)
library(raster)
rastClas1 <- raster(ncol = 10, nrow = 10,
xmn = -1000, xmx = 1000, ymn = -100, ymx = 900)
values(rastClas1) <- floor(runif(100, min = 1, max = 5))
rastClas2 <- raster(ncol = 10, nrow = 10, xmn = -1000, xmx = 1000, ymn = -100, ymx = 900)
values(rastClas2) <- floor(runif(100, min = 1, max = 5))
change <- coverChange(rastClas1, rastClas2)