I am trying to use Leaflet package in R to draw a amp and connect the markers given the latitude and longitude information in the table below.
| Observation | InitialLat | InitialLong | NewLat | NewLong |
|-------------|------------|-------------|-----------|-----------|
| A | 62.469722 | 6.187194 | 51.4749 | -0.221619 |
| B | 48.0975 | 16.3108 | 51.4882 | -0.302621 |
| C | 36.84 | -2.435278 | 50.861822 | -0.083278 |
| D | 50.834194 | 4.298361 | 54.9756 | -1.62179 |
| E | 50.834194 | 4.298361 | 54.9756 | -1.62179 |
| F | 50.834194 | 4.298361 | 51.4882 | -0.302621 |
| G | 47.460427 | -0.530804 | 51.44 | -2.62021 |
| H | 51.5549 | -0.108436 | 53.4281 | -1.36172 |
| I | 51.5549 | -0.108436 | 52.9399 | -1.13258 |
| J | 51.5549 | -0.108436 | 51.889839 | -0.193608 |
| | 51.5549 | -0.108436 | 52.0544 | 1.14554 |
I want to draw lines from an initial point given by the coordinates in the InitialLat and InitialLong columns to an end point given by the NewLat and NewLong columns.
Here is my current R code which only draws the markers on the map.
library(leaflet)
map3 = leaflet(data) %>% addTiles()
map3 %>% addMarkers(~InitialLong,~InitialLat, popup=~Observation)
