On Tue, 19 Aug 2008, Murray Richardson wrote:
Hello again users,
I'm having trouble figuring out how to format the data slot in spatial
SpatialPolygonsDataFrames. I need to use spRbind to combine polygons from
different shapefiles but encounter the problem of having different numbers of
columns, and also non-unique IDs. If the polygons come from different
shapefile sources and have different columns in the dbf, what is the best way
to format them to use spRbind?
Can't seem to find some info on this.
See rbind for data frames - it cannot be done by design. The columns of
the data frames to be stacked must have the same names and types of data
for the same names. If they differ, you'll have to create a combined data
frame with NAs and copy across. In addition, you must have unique IDs, so
perhaps start there, insert the relevant IDs into the combined data frame,
and rebuild the whole object. Probably you should drop as many columns
from your input data as possible to reduce the work to be done.
Roger
Thanks for any help.
Murray
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo