[R] converting zipcodes to latitude/longitude

Nicola Ruggiero n|co|@@rugg|ero@unt @end|ng |rom gm@||@com
Mon May 13 21:56:35 CEST 2019

Hello everyone,

I've downloaded Jeffrey Breen's R package "zipcode," which has the
latitude and longitude for all of the US zip codes. So, this is a
data.frame with 43,191 observations. That's one data frame in my

Then, I have another data.frame with over 100,000 observations that
look like this:

waltham, Massachusetts 02451
Columbia, SC 29209

Wheat Ridge , Colorado 80033
Charlottesville, Virginia 22902
Fairbanks, AK 99709
Montpelier, VT 05602
Dobbs Ferry, New York 10522

Henderson , Kentucky 42420

The spaces represent absences in the column. Regardless,
I need to figure out how to write a code that would, presumably, match
the zipcodes and produce another column to the data frame with the
latitude and longitude. So, for example, the code would recognize
02451 above, and, in the the column next to it, the code would write
42.3765° N, 71.2356° W in the column next to it, since that's the
latitude and longitude for Waltham, Massachusetts.

Any idea of how to begin a code that would perform such an operation?

Again, I have a data.frame with the zipcodes linked to the the
latitudes and longitudes, on the one hand, and another data.frame with
only zipcodes (and some holes). I need to produce the corresponding
latitude/longitudes in the latter data.frame.


More information about the R-help mailing list