make a dataset of 4 sets of coordinates in longitude and latitude format, then using st_as_sf convert these into 2 geometry columns in r in r

# Creating a data frame with 4 sets of coordinates in longitude and latitude format
df <- data.frame(
  lon = c(-121.8863, -118.2437, -117.1611, -120.7401),
  lat = c(37.3382, 34.0522, 32.7157, 35.1495)
)

# Converting the data frame to a spatial object
library(sf)
coordinates <- st_as_sf(df, coords = c("lon", "lat"), crs = 4326)
332 chars
10 lines

gistlibby LogSnag