library(terra)
m = matrix(0, 33, 33)
r = rast(m)
ext(r) = c(0, 10, 0, 10)
r = makeClass(r, 5, 10)
plot(r)
rr = expandClass(r, 1, 100)
plot(rr)
## This function can be used to mimic shapes, by providing a skeleton:
m[,17] = 1
r = rast(m)
ext(r) = c(0, 10, 0, 10)
plot(r)
rr = expandClass(r, 1, 100)
plot(rr)
Run the code above in your browser using DataLab