convert geometry from a .shp file into a new df with id and x and y coordinates in r
library(sf)
# Read the shapefile
Shapefile <- st_read("path_to_file.shp")
# Extract coordinates
coords <- st_coordinates(Shapefile)
# Create a data frame with id and x,y coordinates
df <- data.frame(id = 1:nrow(coords), x = coords[, "X"], y = coords[, "Y"])