I have a map of France with the contour of French departments in an SVG file. I would like to import the data in R to draw a choropleth map. Is it possible ? What would be the best solution ?
There's SVGMapping::loadSVG
(at CRAN) -- I haven't tried it so can't speak to its quality.
Edit: might as well mention the sos
package here, as it's really an indispensable tool for finding R
packages and functions for the user.
I guess it is possible. SVG is nothing more than a XML document. But why don't you use maps
library?
library(maps)
map('france')
You can check:
> map('france')$names
[1] "Nord"
[2] "Pas-de-Calais"
[3] "Somme"
...
for departments names, and paint individual departments like this:
colors[c(112, 114)] <- 'blue'
map('france', fill=T, col=colors)
See maps documentation for more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With