library(terra)
m = matrix(c(3,3,3,3,1,3,
3,3,3,2,1,2,
3,3,3,1,2,1,
1,3,2,2,2,2,
2,2,2,1,1,2,
1,2,1,1,1,1),
nrow = 6,
byrow = TRUE)
m = rast(m)
names(m) = 'sim'
plot(m, col = c("#d2eaac", "#a3dae1", "#8cc1e1"))
gc1 = geocd_raster(m,1)
gc2 = geocd_raster(m,2)
gc1
plot(gc1)
gc2
plot(gc2)
Run the code above in your browser using DataLab