I have the following raster in R:
> veg
class : RasterLayer
dimensions : 22142, 18123, 401279466 (nrow, ncol, ncell)
resolution : 28.5, 28.5 (x, y)
extent : 329232, 845737.5, 8487420, 9118467 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=utm +zone=20 +south +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
data source : C:\Users\Desktop\RO SICAR\ibge_raster
names : ibge_raster
values : 1, 39 (min, max)
attributes :
ID COUNT NM_UVEG
from: 1 953 Contato Savana / Floresta Estacional
to : 39 57506 Savana Parque sem floresta-de-galeria
I am not so familiar with the raster package but I am trying to get the list of names ("NM_VEG") associated with factor levels ("ID") that R assigned to those names. I tried:
unique(values(veg))
But R returns the levels' "ID" instead of the names in "NM_UVEG":
> unique(values(veg))
[1] NA 5 8 4 14 34 2 13 12 28 36 26 11 25 10 16 17 33 38 3
[21] 15 9 23 29 27 32 22 31 37 6 39 35 7 1 20 24 30 19 18 21
I am sure I am missing some basic commands but I can't figure it out, any ideas? Thank you in advance!