library("raster")
r <- raster(nrows = 6, ncols = 7,
xmn = 0, xmx = 7,
ymn = 0, ymx = 6,
crs = "+proj=utm +units=m")
r[] <- runif(6 * 7)
tr <- transition(r, function(x) 1 / mean(x), 8)
aft <- adjacencyFromTransition(tr)
head(aft)
Run the code above in your browser using DataLab