I am stuck with a problem with leaflet.
I want to plot flight routes (already done with gcIntermediate) but i want to colour the routes based on a factor variable (Status:cancelled,delayed).
I would want delayed routes colored with blue and the cancelled ones with red
my R code:
gcIntermediate(coord1[,c(1,2)], coord1[,c(3,4)],
n=100,
addStartEnd=TRUE,
sp=TRUE) %>%
leaflet() %>%
addTiles() %>%
setView(-100,38, zoom = 4.49) %>%
addPolylines(color="red") %>%
addMarkers(lng=c(coord1[,1],coord1[,3]),lat=c(coord1[,2],coord1[,4]))
where coord1 is a dataframe with: the latitudes and logitudes of two cities and the factor variable(status).