r <- rast(ncols=3, nrows=2, vals=1:6)
coltb <- data.frame(value=1:6, col=rainbow(6, end=.9))
coltb
plot(r)
has.colors(r)
coltab(r) <- coltb
plot(r)
has.colors(r)
tb <- coltab(r)
class(tb)
dim(tb[[1]])
Run the code above in your browser using DataLab