[R-sig-Geo] merging data with SpatialPolygonsDataFrame
stefan lhachimi
stefan.duke at gmail.com
Wed Jan 23 23:22:55 CET 2008
Hello,
I am having a spatial object by reading a shp-file by the
readShapePoly command. I now want to add data into the
SpatialPolygonsDataFrame from an external source (its a dataframe
which has a common key SHN_N). I am using the merge command, which I
thought works fine, unitl I realized that "map.kreise" now became just
a data.frame.
My greatest fear in working with spatial objects is that, if I don't
have them in one object, I end up plotting a value for the wrong
region. So is there a way to use merge or what is the most appropriate
way to combine data?
map.kreise<-readShapePoly("vg250krs",IDvar="KRS_ID",verbos=TRUE) #
reads the shape file
map.kreise<-merge(map.kreise,INC,sort = FALSE,by.map.kreise="SHN_N",
by.INC="SHN_N",all.map.kreise=T,all.INC=T)
Thanks a lot in advance,
Stefan
More information about the R-sig-Geo
mailing list