Skip to content
Prev 163633 / 398506 Next

Help with maps

On Tuesday, December 02, 2008, at 04:40PM, "hadley wickham" <h.wickham at gmail.com> wrote:
Thanks for this.
What format is best?  I don't really have an example, because I only have a data frame with geo and count data.

The map() function gives me the following
head> head(d)
          x        y
1 -86.81457 32.34920  #presumably latitudes and longitudes ???
2 -86.81457 32.33774
3 -86.80311 32.32628
4 -86.79737 32.32055
5 -86.78019 32.32628
6 -86.78019 32.34347

and I am not sure how to join this with data from a csv formatted file with columns for country, state, county, zip code, a, b, c, where a,b,c are integers.   Ideally, I'd like to show a map of the US by county that represents the sum of all "a" in that county with darker colors for larger values of x ...  Then I'd like to do the same for the UK.  If I could do the same at the zip code level for certain counties, that would be even better.
Doesn't that assume that county names and associated counts are mapped to lat/lon ?  How does the map() function understand "france" or "county" so that it can do this internally?  I'd like map() to figure out the lat/lon details.


head> head(d)   
          x        y
1 -86.81457 32.34920
2 -86.81457 32.33774
3 -86.80311 32.32628


Doesn't each row correspond to a vertex?  How to get from vertices to county names with associated counts?
This produces a very small UK in the upper left quadrant.
thanks again in advance