Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add argument df=TRUE to extract #14

Merged
merged 2 commits into from
Nov 18, 2017
Merged

Conversation

MatthieuStigler
Copy link
Contributor

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:

  1. 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

  2. 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.

  3. 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.

@hunzikp hunzikp merged commit 43bbc57 into hunzikp:master Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants