Adding an argument df=TRUE to extract, both for raw data and aggregated (using fun) one. Output is similar to that of raster::extract. Differences include:
With non-overlapping polygons (i.e. polygons whose center does not fall into a cell), raster::extract uses cells around, if small=TRUE. So comparison with raster should be made with small=FALSE
Column name: I named the polygons ID_sp, while raster has ID. I remember being confused when using raster which was the raster and the polygon ID, so something more explicit like ID_sp seems clearer. But for consistency reason, you might well choose to use the same.
Content of the ID_sp column: here returns the polygon ID, not number. In the test, ID is number so don't see the difference, but in other cases difference would show up. Not sure how much this polygon ID is general to shp files, or specific to the sp implementation? I think for example in sf this is not the case anymore?
Please check also what I added in help file, might surely be improved.
Adding an argument df=TRUE to extract, both for raw data and aggregated (using fun) one. Output is similar to that of raster::extract. Differences include:
With non-overlapping polygons (i.e. polygons whose center does not fall into a cell), raster::extract uses cells around, if
small=TRUE
. So comparison with raster should be made withsmall=FALSE
Column name: I named the polygons
ID_sp
, while raster hasID
. I remember being confused when using raster which was the raster and the polygon ID, so something more explicit likeID_sp
seems clearer. But for consistency reason, you might well choose to use the same.Content of the
ID_sp
column: here returns the polygon ID, not number. In the test, ID is number so don't see the difference, but in other cases difference would show up. Not sure how much this polygon ID is general to shp files, or specific to the sp implementation? I think for example in sf this is not the case anymore?Please check also what I added in help file, might surely be improved.