Dan, google refine http://goo.gl/AeKml can actually transform zip codes into longitude/latitude - http://goo.gl/1HDWb will show you how to do this from street adresses, but it should also work from city names -- i think it will allocate a default long/lat for a city, but not sure of the exact mechanism
On Fri, Aug 3, 2012 at 1:10 PM, Lopez, Dan <lopez...@llnl.gov> wrote: > Thank you! > Dan > > From: Sarah Goslee [mailto:sarah.gos...@gmail.com] > Sent: Thursday, August 02, 2012 5:51 PM > To: Lopez, Dan > Cc: R help (r-help@r-project.org) > Subject: Re: [R] Plotting Where People Live on a U.S. Map > > Hi Dan, > > For question 1, yes you'll need geographic coordinates. I thinknit's > possible to get a shapefile of zip codes, but maybe someone else will know > the details. > > For #2, you probably want maps instead of map, and you need to load a > package before you can use it: > install.packages("maps") > library(maps) > and then your code. > > Sarah > > On Thursday, August 2, 2012, Lopez, Dan wrote: > Hi, > > QUESTION TOPIC #1 > I have some data I want to plot on a map. But what I have are home > addresses: street, City, State, complete postal code--i.e 95377-1234. Is > there a way to plot this data or do I need latitudinal and longitude > coordinates? If so how do I convert them? Is there a package that will do > the conversion in R? > > QUESTION TOPIC #2 > I was trying to experiment with this code that I found at the site below > but got a message that indicated that the "map" function is not found. So I > tried installing the maps package but got the below message. Is there an > alternative way of doing this (please refer to URL below)? > > # The message I got: > > install.packages("map") > Warning message: > package 'map' is not available (for R version 2.15.0) > > # The code I tried to run: > states <- data.frame(map("state", plot=FALSE)[c("x","y")]) > colnames(states) <- c("Lon","Lat") > ggplot(states, aes(x=Lon, y=Lat)) + geom_path() > + geom_point(alpha=0.6,size=0.3,data=subway) > > # Where I got the code from and also an image of what I am attempting to > do (please enter this in your URL) > > http://www.google.com/imgres?um=1&hl=en&biw=1790&bih=845&tbm=isch&tbnid=4rMjXYA_w1qDiM:&imgrefurl=http://www.informaniac.net/&docid=SJqcsPghztrj0M&imgurl=http://lh5.ggpht.com/_yBbodrC25kU/Ta6Ifqr0ZLI/AAAAAAABRCg/98rIF-kMMns/map%25255B7%25255D.png&w=512&h=319&ei=mgsbUIzqJuKbiAL5v4DQDg&zoom=1&iact=hc&vpx=176&vpy=477&dur=5741&hovh=177&hovw=285&tx=110&ty=113&sig=117496213270544868088&page=2&tbnh=125&tbnw=200&start=32&ndsp=40&ved=1t:429,r:0,s:32,i:175 > > Dan > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org<javascript:;> mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > > -- > Sarah Goslee > http://www.stringpage.com > http://www.sarahgoslee.com > http://www.functionaldiversity.org > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.