nc = st_read(system.file("shape/nc.shp", package="sf"))
st_write(nc, "nc.shp")
## Not run:
# library(sp)
# example(meuse, ask = FALSE, echo = FALSE)
# st_write(st_as_sf(meuse), "PG:dbname=postgis", "meuse_sf",
# layer_options = c("OVERWRITE=yes", "LAUNDER=true"))
# demo(nc, ask = FALSE)
# st_write(nc, "PG:dbname=postgis", "sids", layer_options = "OVERWRITE=true")## End(Not run)
## Not run:
# library(sp)
# data(meuse)
# sf = st_as_sf(meuse, coords = c("x", "y"), crs = 28992)
# library(RPostgreSQL)
# conn = dbConnect(PostgreSQL(), dbname = "postgis")
# st_write_db(conn, sf, "meuse_tbl", drop_table = FALSE)## End(Not run)
Run the code above in your browser using DataLab