# NOT RUN {
set.seed(0)
r <- rast(nrows=10, ncols=10)
values(r) <- sample(3, ncell(r), replace=TRUE) + 10
d <- data.frame(id=11:13, cover=c("forest", "water", "urban"), letters=letters[1:3], value=10:12)
levels(r) <- d
activeCat(r)
activeCat(r) <- 3
activeCat(r)
# }
Run the code above in your browser using DataLab