library(terra)
mtx = matrix(0, 33, 33)
r = rast(mtx)
ext(r) = c(0, 10, 0, 10)
num = 5
size = 15
rr = makeClass(r, num, size)
plot(rr)
## Create a class of three patches of given size at three corners of the spatial context
size = c(10, 50, 200)
pts = c(1, 33, 1089)
rr = makeClass(r, 3, size, pts)
plot(rr)
Run the code above in your browser using DataLab