I'm trying to merge a Large SpatialPolygonsDataFrame with a non spatial dataframe. Using packages leaflet, sp. I used read_OGR to read in the shapefiles.
I'm getting this Error "cannot get a slot ("Polygons") from an object of type "NULL"" when trying to merge.
Code:
shp.ex <- merge(shp, lookup2, by = 'Location1')
Checking lengths:
`
nrow(shp@data)
[1] 128
nrow(shp@polygons)
NULL
length(shp@data)
[1] 8
length(shp@polygons)
[1] 125
`
I'm aiming to merge the spatial data frame to a lookup so I can select the desired location. So I can then create a SharedData$new for filtering a map in crosstalk.
I've tried making sure my code is not in tidyverse format, and checking the length of the shp objects.