library(terra)
r <- rast(matrix(sample(1:5, 60, replace = TRUE), 5))
uv <- unique(r)[,1L, drop = TRUE]
l <- setNames(vector("list", length(uv)), sprintf("l=%i", uv))
for (i in seq_along(uv)) {
l[[i]] <- r == uv[i]
}
rast(l)
Created
March 19, 2025 12:40
-
-
Save mdsumner/e7a9708a1b6600f47146e2e4e30c433a to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment