Can anyone offer advice/example code on how to create a data frame from the coordinates of a SpatialPolygonsDataFrame?
I have a shapefile I read into R with readOGR() and I want to us it in a pip() function to filter out points that are outside of a certain region. When I try to put it into the pip() I get an error that says Error in as.points(poly) : Cannot make points from this object
So you have a polygon and you want to filter out areas that aren't in a region? A reproducible example would be useful.
Otherwise, have a look at the sf package. Just read in your shapefile, then filter out the points either spatially or based on some criteria in the dataset.