Dear Alina,
 
If you load two datasets to R and you want to merge them via some key (e.g. zip 
code), you have to consider using the "merge" method e.g.:
 
> spdata <- merge(x=data.frame(ZIP=zipshape$ZIP, X=zipshape$X, Y=zipshape$Y), 
> y=data.frame(ZIP=customers$ZIP, V=customers$V), by=ZIP, all.y=F)
> coordinates(merge) <-~X+Y
 
You could also consider using the Google service to geocode the addresses (I do 
not know how accurate is your US zip shape file, Google data is pretty 
accurate).
 
You should be able to figure out from this example what you have to do automate 
retrieval of coordinates from addresses:
 
http://spatial-analyst.net/wiki/index.php?title=Mapping_research_hot-spots#Geocoding_addresses
 
 
HTH
 
Tom Hengl
 
 

________________________________

From: r-sig-geo-boun...@stat.math.ethz.ch on behalf of Alina Sheyman
Sent: Tue 3/3/2009 8:49 PM
To: R-sig-Geo@stat.math.ethz.ch
Subject: [R-sig-Geo] mapping by zip codes



I'm very new to creating maps using shapefiles, so this question might be
pretty basic.

I'm trying to create a map of the US, divided up by zip codes, where i then
map number of customers by zip code.
I located shapefiles for US with zip codes (although at this point only for
individual states, and not the entire country) and read it into R using
maptools,
but now I need to apply my data (which I read into R as a separate data
frame and not a shapefile) to that map. Which is the part where I get
completely lost and not sure how to proceed. If anyone could give me any
pointers I'd really appreciate it.

thank you

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to