I have a data set that includes a list of zip codes. Is there a way in R to convert these zip codes to latitude and longitude coordinates?
There's no strict algorithmic relationship between latitude and longitude and zip code - they're all custom areas generated by the postal service. You need access to a dataset that codes polygons / polygon centroids by zip code.
Traditionally, this task (coupled with address lookup) is termed 'Geocoding'. The most convenient method for full address lookup is to find a preexisting online geocoder, whether by Google Maps, Bing Maps, or ESRI.
For just US zip codes, though, there is data available from the Census:
I'm not familiar with R geospatial capability, but all you should need is polygon->centroid, and centroid->coordinates.
This task is common enough that a preexisting centroid dataset exists: http://coolthingoftheday.blogspot.com/2008/04/free-us-zip-code-database-as-csv.html
have you looked at the
zipcode package? it's basically a dataframe with ~45,000 zipcodes along with their city, state, latitude and longitude.
Seems like you are using Ruby on Rails
Try this tutorial from Ryan Bates http://railscasts.com/episodes/273-geocoder?view=asciicast
I've tried it before and it works perfectly. When you type address or zipcode , it will show the longitude and latitude.