[R-sig-Geo] adding new values to readShapePoly() object

Takatsugu Kobayashi tkobayas at indiana.edu
Wed Jan 2 05:07:19 CET 2008


Hi

Please forgive me if I am asking a simple question. 

I would like to add values in a column vector to readShapePoly() object
and show a map based on these values using spplot() or addPoly().

Basically, my raw data are employment census data with the coordinates
(X,Y). 

tmp1 <- read.csv("tmp1.csv",header=T)

names(tmp1)
 [1] "TAZ"                "X"                  "Y"                 
 [4] "X_UTM"              "Y_UTM"              "Perimeter"         
 [7] "Area"               "in.n"               "D_mean.dist"       
[10] "D_median.dist"      "D_mean.mean.time"   "D_mean.median.time"
[13] "out.n"              "O_mean.dist"        "O_median.dist"     
[16] "O_mean.mean.time"   "O_mean.median.time" 


map <- readShapePoly("Akron",proj4string=CRS("+proj=longlat
+datum=NAD27"))
names(map)


 [1] "SOURCELYR" "SHAPECODE" "COUNTY"    "SHORTLAB"  "LONGLAB"
"X"        
 [7] "Y"         "X_UTM"     "Y_UTM"     "Perimeter" "Area"     

tmp1/tmp2 and map have the same nrows and the same coordinates (X,Y). 

Any suggestions? Should I modify .dbf files before loading .shp files?
Or are there functions like join_table in ArcGIS? Or should I convert
tmp1 into a polypoint object and overlay it on map?

Thank you very much.

Takatsugu




More information about the R-sig-Geo mailing list