Class "Spatial" refers to the old & weary {sp} package; it seems you are now using format of the shiny & new {sf} package (note that both {sp} and {sf} have the same author, Edzer Pebesma, to whom we all owe a lot).
To double check consider running class()
on your object; if my guess is correct it should return something like "sf" "data.frame"
, where sf
is the key output.
You have in principle two options:
- continue using
rgdal::writeOGR()
after applyingas(x, "Spatial")
to your object (wherex
is your object); this will convert your object from new to old package format - write the shapefile using
sf::st_write()
function; this will accept the newer package format
As the {sp} package is on its way out, after a long and productive life, and the {sf} is the new cool kid I suggest the second option.