I have one raster file on land cover (30x30m pixels), one raster file on soil organic carbon (SOC) (250x250m pixels), and one vector file with contiguous polygons. I use ArcGIS 10.5.1. The two raster files and the vector file should have the same extent, because I used the outline surrounding all polygons in the vector file to clip the raster files.
What I require is a mean SOC value for each polygon. But only based on pixels that have a select land cover, here grassland.
I initially tried zonal statistics in ArcGIS but had issues with loading the SOC Raster as a raster input (likely because it is a floating point rather than signed integer). So I decided to move everything into R environment.
In R, I made sure that the two raster files have the same extent and resolution, so I scaled the SOC map to 30x30m. I then turned the vector map into a SpatRaster (perhaps not needed), and realised that the extent is slightly different from the two raster files (the vector file when loaded into R has a 'bounding box' rather than extent, perhaps it relates to that). I also stacked the land cover and SOC files.
I am stuck here now. First, I am not sure if moving from ArcGIS into R was required, or whether my question could be tackled in ArcGIS directly. Second, if I were to go ahead with R, what code could I use to now extract the mean SOC values for grassland for each polygon.