I want to use R to loop through multiple polygons in one shapefile and obtain a zonal statistic (mean) for each polygon from a single raster. The polygons are buffered points of villages (about 84 buffers), and the raster the Hansen GFW data.
I've imported spatialEco and used zonal.stats to obtain some statistics and also extract, but I want to make sure that these are correct and there is no data loss due to the overlap, so creating an iteration of some variety will enable me to be sure that the statistics are representative of each polygon.
ex <- extract(hansen_forest,village_buffer,fun='mean',na.rm=TRUE,df=TRUE,weights=TRUE)
zs <- zonal.stats(village_buffer, hansen_forest, trace = TRUE, stat = MEAN)