Re: [R] converting zipcodes to latitude/longitude

2019-05-15 Thread Jim Lemon
Hi Nicola, Good to learn that you solved the problem. Shape files are usually a set of polygons for the named areas. I did some work with the "rgdal" package a while ago and it wasn't very difficult. There might be better methods now, so posting to R-SIG-geo is a good idea. Jim On Thu, May 16, 2

Re: [R] converting zipcodes to latitude/longitude

2019-05-15 Thread Nicola Ruggiero
Hi Jim, I ended up collaborating with someone, and, on the basis of looking at your code (we did take it into consideration and talk about it), we came up with this: library(stringr) numextract <- function(string){ str_extract(string, "\\-*\\d+\\,*\\d*") } myDataSet$zip<-numextract(myDataSet

Re: [R] converting zipcodes to latitude/longitude

2019-05-13 Thread Jim Lemon
Hi Nicola, Getting the blank rows will be a bit more difficult and I don't see why they should be in the final data frame, so: townzip<-read.table(text="waltham, Massachusetts 02451 Columbia, SC 29209 Wheat Ridge , Colorado 80033 Charlottesville, Virginia 22902 Fairbanks, AK 99709 Montpelier, VT

[R] converting zipcodes to latitude/longitude

2019-05-13 Thread Nicola Ruggiero
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 environment. Then, I have another data.frame with over 100,000 observations that lo