How to plot data related to some country or region on the map of that region in R?

r
datavisualization

#1

Hello,

I have a data frame with some data related to the USA

df
usa_state Life.Exp HS.Grad
1 Alabama 69.05 41.3
2 Alaska 69.31 66.7
3 Arizona 70.55 58.1
4 Arkansas 70.66 39.9
5 California 71.71 62.6

Can I plot this data on the states map of USA? How to do this in R?

Thanks


#2

@mukesh, look into the ggmaps package. It has preset values for the state boundaries of the US, which you can use to plot your data. For instance, http://bcb.dfci.harvard.edu/~aedin/courses/R/CDC/maps.html.


#3

also try leaflet package
https://rstudio.github.io/leaflet/

and

https://rstudio.github.io/leaflet/map_widget.html

or this package

http://datamaps.github.io/