I have a TIFF output from FRAGSTATS along with an attribute table with different variables. I'd like to add this to R with the end goal of extracting a map of each variable from the attribute table so I can then add these into an occupancy model.
The TIFF from FRAGSTATS has been manipulated in ArcGIS to be a ESRI GRID, then back to a TIFF so the resulting tif has a 'values' field which identifies the grid location. This field matches to the patch ID (PID) field in the attribute table.
FRAGTIF<- raster("/patchmetrics.tif")
> FRAGTIF
class : RasterLayer
dimensions : 600, 1055, 633000 (nrow, ncol, ncell)
resolution : 33.54191, 33.54191 (x, y)
extent : 5305396, 5340783, -2247132, -2227007 (xmin, xmax, ymin, ymax)
crs : +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
source : C:/Users/e77-smith/Desktop/MadOccMod/FRAG Layers/patchmetrics.tif
names : patchmetrics
values : 1, 8374 (min, max)
patch.df <- read.csv(file = "/Users/e77-smith/Desktop/MadOccMoD/210622 fragout.csv")
patch.df
PID TYPE AREA PERIM GYRATE SHAPE CORE PROX SIMI ENN
1 1 cls_0 107.2188 33944.504 3833.3469 8.1613 107.2188 0.000 0.000 3152.9480
patch.df has 8374obs of 10 variable so I'm pretty sure it matches.
I can't figure out how to join them, I've tried left_join but I think that only works for vector files.