I have two huge shapefiles. One contains polygons of one kind of vegetation and the other one representing a grid. A situation as follows but, of course, much bigger:
I need:
- the efficient way to open and handle both files using R, because my computer "suffers" opening both using readOGR or shapefile even if I have a 32 GB RAM i7;
- I need to get a matrix-like (or dataframe) containing the number of polygons for each square within the grid, something like this (from the previous example):
st_read
from thesf
package? Is the grid completely regular and axis-aligned? If it is then you don't need to read it in, you can work out things from the geometry only (extent and resolution).