R function bdc_country_from_coordinates not working

79 Views Asked by At

I am trying to make a column of country names from a dataset that has one column for latitude and one column for longitude. However, when I use the function bdc_country_from_coordinates(), I'm receiving this error message:

Error in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, :
Loop 0 is not valid: Edge 1028 has duplicate vertex with edge 1033

Does anyone know how to resolve this? Attached below is my code:

library(bdc)
library(rnaturalearthdata)
library(rnaturalearth)

# latlong_data is my dataset with a column for lat and a column for long 
# called "decimalLatitude" and "decimalLongitude"

bdc_country_from_coordinates(latlong_data,
                             lat = "decimalLatitude", 
                             lon = "decimalLongitude", 
                             country = "country”)

I also ran the example on on this page and received the same error message.

0

There are 0 best solutions below