How do I convert an sf object back to a SpatialPolygonsDataFrame?
I am running R 3.4.0 and sf version 0.4.1. The sf documentation mentions an
as_Spatial function, but this isn't available in my install (for some reason).
as part 2 of the vignette by Edzer Pebesma indicated (Scroll to the bottom of the page).
I had to use
sf:::as_Spatial() as workaround.
library(sf) nc <- st_read(system.file("shape/nc.shp", package="sf")) # sf -> sp nc_sp <- as_Spatial(nc$geom) # Error: could not find function "as_Spatial" nc_sp <- sf:::as_Spatial(nc$geom) # This works library(sp) plot(nc_sp)