topoJSON and geoJSON files are know very common for drawing maps on the internet. Is it possible to import them in R to draw choropleth maps?
Spacedman
Get the rgdal package installed. Then if:
library(rgdal)
> "GeoJSON" %in% ogrDrivers()$name
[1] TRUE
then you can do something like:
> map = readOGR("foo.json", "OGRGeoJSON")
> plot(map)
But you need GeoJSON support in your ogrDrivers list.
来源:https://stackoverflow.com/questions/24183007/is-it-possible-to-read-geojson-or-topojson-file-in-r-to-draw-a-choropleth-map