title: Assign ID for Road segment ( Latitude longitude) in R Code
body: <p>I want your ideas and suggestion in handling the following dataset:</p>
  
  <pre><code> Start_Latitude    Start_Longitude   End_Latitude    End_Longitude       Date        Avg_Speed
       41.92446         -87.68654       41.93184        -87.67459     2020-06-11 6:00       40
       41.90367         -87.63233       41.91600        -87.61911     2020-06-11 6:00       35
       41.86468         -87.76746       41.82341        -87.69162     2020-06-11 6:00       54
       41.96075         -87.74756       41.76543        -87.67459     2020-06-11 6:00       45
  </code></pre>
  
  <p>I have the variables :Start_Latitude, Start_Longitude, and End_Latitude, End_Longitude that represent road segment and I have the average speed of each road segment.</p>
  
  <p>I want to assign Id for each road segment that starts with Latitude and Longitude, and ends with Latitude and Longitude, so I can compare the average speed with another road segment.</p>
  
  <p>The data I want will look like :</p>
  
  <pre><code>   St_Lat_Long             End_Lat_Long              Date         Avg_Speed     ID
  41.92446, -87.6865       41.93184,-87.67459     2020-06-11 6:00       40         1
  41.90367,-87.63233       41.91600,-87.61911     2020-06-11 6:00       35         2
  41.86468,-87.76746       41.82341,-87.69162     2020-06-11 6:00       54         3
  41.96075,-87.74756       41.76543,-87.67459     2020-06-11 6:00       45         4
  </code></pre>
  
  <p>How can I assign Id in R code?
  I have the following code that assign ID for one spatial point that has Start_Latitude, Start_Longitude ( 2 coordinates:</p>
  
  <pre><code>Data$ID &lt;- cumsum(!duplicated(df[1:2]))
  
   Latitude    Longitude          Date          Avg_Speed    ID
  41.92446     -87.68654    2020-06-11 6:00       40          1
  41.90367     -87.63233    2020-06-11 6:00       35          2
  41.86468     -87.76746    2020-06-11 6:00       54          3
  41.96075     -87.74756    2020-06-11 6:00       45          4
  </code></pre>
  
  <p>Also, is it possible  to plot all roads segment on the map using 4 coordinates.</p>