I have two raster layers with urban cells and rural cells. I used an overlay function to compare these two raster layers and see the differences. Before overlaying I gave urban cell the value 1 and rural cell the value 0. After overlaying I get the result: 0,1,2,NA: Clearly, 2 and 0 mean that the urban and rural cells match and 1 mean it doesn't. however just looking at 1 i cannot see if the error was occured due to urban cell or rural cell. Does anyone know how can I see where the inaccuracy in this raster layer is if i take one of the raster layers as reference?
b
class : RasterLayer
dimensions : 190, 333, 63270 (nrow, ncol, ncell)
resolution : 0.008344257, 0.008344257 (x, y)
extent : 12.10615, 14.88479, 51.68836, 53.27377 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
c
class : RasterLayer
dimensions : 190, 333, 63270 (nrow, ncol, ncell)
resolution : 0.008344257, 0.008344257 (x, y)
extent : 12.10615, 14.88479, 51.68836, 53.27377 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
uc <- overlay(c, b, fun=function(x,y){return(x+y)})
urx <- overlay(c, b, fun=function(x,y){return(x*y)})
cellStats(uc, stat = "sum",na.rm = TRUE)
unique(getValues(uc))
[1] NA 0 1 2