This is a collection of R code for that I have been using for visualizing spatial data. Each of the different types of mapping techniques are briefly discussed below. As I explore more techniques, they will be added to the list.
In this example, point data is mapped onto a country map.
https://github.com/asheshwor/R-maps/blob/master/01_simple-map.R
Points across the globe are connected using great circle arcs in this example. An excellent way to visualize global inter-connections. In the first example, tourist arrival data for Nepal is visualized with colours representing the number of arrivales. The arrival figures have been extracted from pdf file at http://www.tourism.gov.np/uploaded/TourrismStat2012.pdf with a few edits on the name of countires to match the ones on the map.
https://github.com/asheshwor/R-maps/blob/master/02_great-circle-map.R
Another example of great circle map with international work permits data for Nepal. The figures have been extracted from pdf file at www.dofe.gov.np (in Nepali language) with minor edits on the name of countries.
See example at http://asheshwor.com.np/host/heatmap.html
See example at http://asheshwor.com.np/host/workpermits2011.html
Code:
- Interactive maps using Shiny - Leaflet integration
Leaflet map in a Shiny app for visualizing Nepal earthquake data https://github.com/asheshwor/np-quake
See live example at: https://asheshwor.shinyapps.io/np-quake
- ggmap square map plots
Code example: https://github.com/asheshwor/R-maps/blob/master/05_ggmap_google_location.R