0

I have a raster image and a corresponding shapefile. I would like to calculate the statistics of the values within polygons which have a common attribute but only using pixels which are fully contained in the polygons.

I would like to do this in R, however I have so far only managed to load the image and shapefile using readGDAl and readOGR respectively!

nmtoken
  • 13,355
  • 5
  • 38
  • 87
Noella
  • 127
  • 5
  • And you have looked into the raster package? Specifically the function extract ? – Curlew Oct 28 '13 at 10:05
  • @Curlew, when i use the function extract, i get an error report saying 'unable to find an inherited method for function ‘extract’ for signature ‘"SpatialGridDataFrame" – Noella Oct 28 '13 at 10:13
  • 1
    Rather than answer as a Comment I would recommend revising your Question with the additional details people ask for by using the edit button. – PolyGeo Oct 28 '13 at 10:19
  • @Noella, just convert it into an raster object beforehand for instance with function raster(...). – Curlew Oct 28 '13 at 10:52

0 Answers0