I have a land classification raster with factor levels set (pixel val of 1 = 'type a', etc), plus a data frame holding the same factor in the first column, and then several columns of numeric attribute data.
I'd like to generate a new rasterBrick/rasterStack where that numeric data is mapped out - one map for each attribute. Not sure how to do this properly in R. I've tried
test <- merge(raster@data@attributes[], data.frame, by = 'category')
but that gives me a single-band rasterLayer with multiple attributes (i.e. a RAT with more columns), which I can't then write to GTiff properly.