Nicole Homeier
2011-Oct-25 14:50 UTC
[R] gvisGeoChart not recognizing US states as regions
I'm having trouble using gvisGeoChart with region fills. I would like to
fill a map of the U.S. by state. The documentation says it can be of the
form "US-NJ" or "New Jersey", but I tried both and neither
works for me.
When I tried the latter the country of Georgia is filled, so at least
it's doing something. Am I forgetting to set something important? Here
is a code sample:
require(googleVis)
data=read.csv("states_w_prob.csv")
GeoC=gvisGeoChart(data,locationvar="Name",numvar="prob",options=list(dataMode="regions"))
plot(GeoC)
(locationvar can be "Name" or "code")
And the first few rows of the csv file:
Name state Lat Long code MLAT prob
Alaska AK 61.385 -152.268 US-AK 67.16471 NA
Alabama AL 32.799 -86.8073 US-AL 40.19146 0.177872
Arkansas AR 34.9513 -92.3809 US-AR 42.68162 0.215224
Thanks in advance for any insight.
Nicole
[[alternative HTML version deleted]]