title: Convert features of a 'multifeature' GeoJSON into R spatial objects
body: <p>Normally you can read geojson files into R with trusty <code>readOGR</code>, as illustrated <a href="https://github.com/Robinlovelace/Creating-maps-in-R/blob/master/vignettes/geoJSON.Rmd" rel="nofollow">here</a>.</p>
  
  <p>However, this fails for multifeature geojsons.</p>
  
  <p>Reproducible example:</p>
  
  <pre><code>downloader::download("https://github.com/Robinlovelace/Creating-maps-in-R/raw/master/data/test-multifeature.geojson", "test.geojson")
  test &lt;- rgdal::readOGR("test.geojson", "OGRGeoJSON") # fails with:
  
  Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv,  : 
    Multiple incompatible geometries: wkbPoint: 98; wkbLineString: 660; wkbPolygon: 23
  </code></pre>
  
  <p>The error message is clear-enough and indicates a solution: split the features.
  Aside from doing this with regex, I don't know how, however.</p>
  
  <p>Any ideas very much welcome.</p>
  
  <p>The amazing thing: <a href="https://github.com/Robinlovelace/Creating-maps-in-R/blob/master/data/test-multifeature.geojson" rel="nofollow">GitHub displays the data natively on the browser</a>, whereas R cannot even (seemingly) read it in!</p>
  
  <p>Alternative way to a solution:</p>
  
  <pre><code>test &lt;- geojsonio::geojson_read("test.geojson")
  </code></pre>