EDIT:
If the attribute data is in a dbf, try something like this:
# read the tif in with RAT = TRUE. Should get an ID column at least in the resulting object.
data_tif <- raster(file.path(getwd(), 'a2_LOt_12_v170321.tif', RAT = TRUE)
# read the dbf in as a data frame
data_dbf <- foreign::read.dbf(file.path(getwd(), 'a2_LOt_12_v170321.tif.vat.dbf'))
Have a look at levels(data_tif)[[1]]
and compare with data_dbf
. Make sure number of rows matches, and look for columns in common (ID in the RAT may match VALUE in the dbf, for instance). You can then use base::merge
or dplyr::left_join
to append the dbf data to the RAT.
Note that write support for RATs is minimal - some advice is here: https://stackoverflow.com/questions/23840178/how-to-write-a-raster-with-rat-factors-in-r-raster-package
Thanks to this question for providing some data I could test with.