I have a RasterStack with 2 raster layers of the same area, one from a SpatialPolygonsDataFrame (layer1) and another NDVI satellite image (NDVI). layer1 has a series of polygons, each with various land-use attributes.
I am interested in using attributes in layer1 (those partitioning the layer according to various Factors), to query the NDVI layer. I'd like to be able to compare different levels of the factor statistically, or graphically by boxplots or similar. I'd also like to be able to add additional NDVI images, and compare across NDVI layers for the same Factors.
Is it possible to do this - which functions / packages should I look at?
extract() allows queries by separate Spatial objects, doesn't seem to allow query by attributes. I haven't been able to find a solution on this site.
Clearly these operations can be done by using separate Raster and Spatial objects, but I suspect using a RasterStack would be more efficient. Or is there another way altogether?