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)

Arguments

x

Raster* object

v

integer cell values

layer

integer > 0 indicating which layer to use (in a RasterStack or RasterBrick)

att

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

append.names

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

na.rm

Logical. If TRUE, then the NAs will be removed, returning a possibly shorter vector