Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.