From static maps to dynamic maps

So, last week, we saw how we could plot shapefiles in ggplot2. This is great! But, oddly, sometimes static. What if you want to no only put shapefiles on a map, but add other information (say, sites), and then make the whole thing interactive - like a google map! You can!

Adding temperature data to SpatialPolygons

So, a shapefile has some inherent properties in and of itself so that it can be plotted.

library(sp)
library(rgdal)
## rgdal: version: 1.1-3, (SVN revision 594)
##  Geospatial Data Abstraction Library extensions to R successfully loaded
##  Loaded GDAL runtime: GDAL 1.11.1, released 2014/09/24
##  Path to GDAL shared files: /usr/local/share/gdal
##  Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
##  Path to PROJ.4 shared files: (autodetected)
##  Linking to sp version: 1.2-0
ecoregions <- readOGR("./join_maps/MEOW-TNC/meow_ecos.shp", layer="meow_ecos")
## OGR data source with driver: ESRI Shapefile 
## Source: "./join_maps/MEOW-TNC/meow_ecos.shp", layer: "meow_ecos"
## with 232 features
## It has 9 fields
plot(ecoregions)