[R-sig-Geo] Difference in size between extract and crop functions

Alex Fitz afitz at email.wm.edu
Thu Jun 9 15:31:58 CEST 2016


Hi,

I am currently trying to match my area data for each cell in a raster to the population of each cell to calculate the density.  When I run the crop function to get the specific state data that I want I have significantly more rows/cells of data than when I run my extract function to get the populations given.  Since they aren’t the same size I can’t join them together.  I’m thinking maybe I have some NA data or extra points when I run my crop but i’m not sure how to check. Any help would be greatly appreciated.

These are the crop and extract functions I am running:
state_crop <- crop(pop_world_2015, states, df = TRUE)
state_pop_15 <- extract(pop_world_2015, states, df= TRUE)

This is how i’m calculating the area:
state_area <- raster::area(state_crop)

Thanks, Alex Fitz


More information about the R-sig-Geo mailing list