4 Mapping the Data (by Destination)

We can do the same for receivers (destination).

We will also include flowtypes

While the region is based on the destination (usually retailers) for outgoing shipments, the incoming shipments (e.g., return flows) may flow from retailers to distribution centers.

Below, the flows for region 6 are mapped; and the flows for outgoing shipments, that is, the typical flows from distribution centers anywhere, to retailers in region 6.

All flows:

# fl_to <- fashlogNum[,c("flowtype","latto","lonto","region")]
# names(fl_to)[2] <- "lat"
# names(fl_to)[3] <- "lon"
# head(fl_to)
# fl_to_6 <- fl_to[fl_to$region==6,] 
# leaflet(fl_to_6) %>% addTiles() %>% addMarkers(clusterOptions = markerClusterOptions())

Only outgoing flows:

# fl_to_6 <- fl_to[fl_to$region==6 & fl_to$flowtype>1,] # 1 (incoming flows) are excluded
# leaflet(fl_to_6) %>% addTiles() %>% addMarkers(clusterOptions = markerClusterOptions())

Again, when copying and running the script, leave out the #’s!

Below, a screen shot of the last set of commands.