I have a raster (say r) and a polygon shapefile (say s, containing many polygons). I want to convert the pixelated r to mean of s boundaries. And I need these boundary means as another raster file.
What I have now is the extract function:
rmean <- extract(r,s,fun=mean,df=TRUE)
but, I am not able to convert this into a raster.
Thanks in advance for help.