title: rMaps ichoropleth with custom map/shp
body: <p>In R, I would like help in trying to replicate the tutorial <a href="http://lcolladotor.github.io/2014/02/26/excited-by-willingness-to-help-get-things-done/#.VSfqOvnF8sY">here</a> for my own custom SHP (Shapefile) file or map to be an interactive choropleth map...</p>
  
  <p>The map is of the Small Areas of Northern Ireland. Which can be found <a href="http://www.nisra.gov.uk/geography/SmallAreas.htm">here</a>. </p>
  
  <p>Below are the steps I have taken so far...</p>
  
  <p>I think the issue is the setting of the <code>geographyConfig</code> data...</p>
  
  <p>Any help would be much appreciated....</p>
  
  <pre><code># Download and unzip the data
  system('wget http://www.nisra.gov.uk/archive/geography/digital_products/SA2011_Esri_Shapefile.zip')
  system('unzip SA2011_Esri_Shapefile.zip')
  
  # Load libraries
  library(rgdal)
  library(rgeos)
  library(rMaps)
  
  shp.file &lt;- 'SA2011.shp'
  
  # Convert projection
  system(paste0('ogr2ogr tmp.shp ',
                 shp.file,
                ' -t_srs "+proj=longlat +ellps=WGS84 +no_defs +towgs84=0,0,0"'))
  
  # Read in the data
  xx &lt;- readOGR(dsn=getwd(),layer='tmp')
  mm &lt;- xx@data
  head(mm)
  n &lt;- nrow(mm)
  dat.val &lt;- mm$Hectares
  
  # Add extra year data
  mm &lt;- mm[rep(seq(n),3),]
  mm$Hectares &lt;- c(dat.val,rev(dat.val),dat.val/2)
  mm$year &lt;- rep(c(2000:2002),each=n)
  colnames(mm)[1] &lt;- 'ID'
  id.var &lt;- 'SA2011'
  
  
  # Convert to json
  system(paste0('topojson -o tmp.json -s 1e-7 -q 1e5 tmp.shp -p ID=',
                id.var,
                ' --id-property ',
                id.var))
  
  d1 &lt;- ichoropleth(Hectares ~ ID, data = mm, ncuts = 9, pal = 'YlOrRd', 
                    animate = 'year',  map = 'states'
  )
  d1$set(
    geographyConfig = list(
      dataUrl = "tmp.json"
    ),
    scope = 'states',
    setProjection = '#! function( element, options ) {
    var projection, path;
    projection = d3.geo.mercator()
    .center([-7, 55]).scale(element.offsetWidth)
    .translate([element.offsetWidth / 2, element.offsetHeight / 2]);
  
    path = d3.geo.path().projection( projection );
    return {path: path, projection: projection};
    } !#'
  )
  d1$save('rMaps.html', cdn = TRUE)
  </code></pre>
  
  <p>Loading <code>rMaps.html</code> does not produce the relevant map, as it only shows the cuts at the bottom but not the map.</p>