library(sf)
# Read in the watershed shapefile
ws <- st_read("data/source/watersheds/WBDHU12.shp")
# Write a copy to file in the shapefile format
st_write(ws, "outputs/test.shp")
# Write a copy into a geodatabase. This creates the geodatabase in the process if it doesn't exist.
st_write(ws, "outputs/test.gdb", layer = "watersheds")
# write a copy into a geopackage.
st_write(ws, "outputs/test.gpkg", layer = "watersheds")
# Use st_layers to view layers
st_layers("outputs/test.gdb")
st_layers("outputs/test.gpkg")