maps - Plotting great circles from a subset in R -


I have a data frame that after some processing (for example, geocoding) the following characteristics are:

'data.frame': 13 observers of 5 variables: $ id: int 1 2 3 4 5 6 7 8 9 10 ... $ ciudad: factor w / 10 level "auch", "barcelona ", ..: 8 4 5 3 2 7 9 10 6 6 ... $ proyecto: int 1 1 1 1 1 1 1 1 2 2 ... $ lon: num -1.131 0.564 -9.139 0.627 2.173 ... $ Latitude: Number 38 44.2 38.7 44.5 41.4 ...

Every project has a list of cities and I need to connect radially Confirms, in the first of these (projects) with . That's what I have been doing so far:

  # Make the first letter municipios & lt; - read.csv ("ciudades.csv", header = right September = ",") stri_trans_totitle (Aschcharacter (municipality $ ciudad)) write.csv (municipality, file = "municipal .csv") # Receiving Latitude and Amp; Longitude lonlat & lt; - geocode (as.character (municipios $ Ciudad)) municipios_lonlat & lt; - cbind (municipios, lonlat) write.csv (municipios_lonlat, file = "municipios_lonlat.csv") str (municipios_lonlat) #imple map xlim plot & lt; - c (-13.08, 8.68) ylim & lt; - C (34.87, 49.50) map ("world", col = "# 191,919", filling = true, bg = "# 000000", LWD = 0.05, xlim = xlim, ylim = ylim) # plot city symbols (municipios_lonlat $ Longitude, municipios_lonlat $ lat, bg = "# e2373f", FG = "#FFFFFF", LWD = 0.5, circles = delegate (1, length (municipios_lonlat $ longitude), inch = 0.05, plus = TRUE) #Substation, partition & Amp; Adding uniq & lt; - Unique (unions (municipios_lonlat $ proyecto)) for (I: 1: length (uniq)) {data_1 & lt; - subset (municipios_lonlat, proyecto == uniq [i]) (i in 2: length (data_1 $ longitude) -1) {lngs & lt; - C (Data_1 $ longitude [1], data_1 $ longitude [i]) waves & lt; - C (data_1 $ lat [1], data_1 $ lat [i]) lines (Lngs, lats, col = "# e2373f", lwd = 2)}}  

Is not the real choice. So I need to use the great board to improve the resultant map. I know that I have to use the geo-level library, and in the last paragraph I have to use the same loop. But what I tried to do does not work, can you help me? You are my only hope OB Van Kenobis

Note: You can download your data


Comments