Geometry to lat lon


I have a shapefile named countyonevariable

I want to have lat and lon as column for the shapefile. Cause I want to label based on COUNTYFP. However, the code require lat lon for the shapefile. I am trying to convert this geometry column to lat lon. How can this be done?

Hi I assume that you want to extract the coordinates from the object.

countryonevariable %>%
  dplyr::mutate(lon = sf::st_coordinates(.)[,2],
                lat = sf::st_coordinates(.)[,1])
1 Like

Not clear what you are trying to do. You have lat-longs as your geometry already. Are you getting an error when you try to plot the data? Tell us more.
A reproducible example would help as well.