[click to enlarge]
I’ve recently been playing around with the ggmap package in R and was able to quickly put together a bubble chart version of student home zip codes. As you can see from the two legends, the size and color both reflect the number of students in these zip codes.
I will certainly be playing around with ggmaps so more as this map required only two lines of code (after the ggmap library was loaded).
R CODE:
usmap<-qmap(‘united states’, zoom=4, source=’osm’,extent=’panel’)
usmap+geom_point(aes(x=X, y=Y, size=COUNT, color=COUNT), data=DATA, alpha=.5)
HAPPY HOLIDAYS!
Thanks for this example! I’m new to using R, got it all installed and packages loaded, but could you give a little more info on getting your script to work?
I’m getting the errors:
usmap<-qmap(‘united states’, zoom=4, source=’osm’,extent=’panel’)
Error: unexpected input in "usmap usmap+geom_point(aes(x=X, y=Y, size=COUNT, color=COUNT), data=DATA, alpha=.5)
Error: object ‘usmap’ not found
>
I got a little further – was having problems with slanty quote characters from cut and paste!
Hi Alex – my remaining question is that I need some guidance on how to import my data. I basically have a list of zipcodes. Could you guide me on the import process and how to geocode the zipcodes for lat and lon?
Thanks,
Eric
I got myself straightened out. I’ll post my script when I’m done!
Thanks,
Eric
Hi, Eric – sorry Alex didn’t see your note to respond before he left. Glad you’re straightened away! Robin