Note there is an option to remove the NAs, which will make it MUCH faster,
if TRUE
factorValues2(x, v, layer, att, append.names, na.rm = FALSE)
Raster* object
integer cell values
integer > 0 indicating which layer to use (in a RasterStack or RasterBrick)
numeric or character. Which variable(s) in the RAT table should be used. If NULL
, all variables are extracted. If using a numeric, skip the first two default columns
logical. Should names of data.frame returned by a combination of the name of the layer and the RAT variables? (can be useful for multilayer objects
Logical. If TRUE
, then the NAs will be removed, returning a possibly
shorter vector