rgdal packge is not working anymore. I used writeOGR
writeOGR(occ_sp, species_set[i], driver = "ESRI Shapefile", dsn = dsn, overwrite = TRUE)
error:
Error in writeOGR(occ_sp, species_set[i], driver = "ESRI Shapefile", dsn = dsn, : could not find function "writeOGR"
I moved to use st_write to save my spatialpointsdataframe to shape file. This produce the errors.
st_write(occ_sp,"occ_sp.shp")
error:
Error in UseMethod("st_write") : no applicable method for 'st_write' applied to an object of class "c('SpatialPointsDataFrame', 'SpatialPoints', 'Spatial', 'SpatialVector')"