[R-sig-Geo] Problems preserving attribute data while merging fields in shapefiles

Roger Bivand Roger.Bivand at nhh.no
Wed Nov 14 09:10:37 CET 2007


On Tue, 13 Nov 2007, Levi Rose wrote:

> To all,
>
> Currently, I have old datasets(shapefiles) that contain a plant code #
> field in the attributes table.  I have successfully merged in a table
> with spp. names to correspond with the plant code #'s.  During this
> process my attribute data is resorted and I lose continuity with other
> attribute data. (I'm using the (sp) and (maptools) libraries to
> execute read/write Poly/Point shape functions.)  While merging, how do
> you maintain continuity between all of the other fields in your
> attributes table?

Please include the output of sessionInfo(), and example code (preferably 
using shapefiles shipping with maptools or others that are posted 
somewhere) to show your workflow. It is not easy to "look over your 
shoulder" from your description above.

In general, the row names of point coordinate matrices and the row names 
of the included data frame should agree for SpatialPointsDataFrame 
objects, and the Polygons objects ID slots should agree with the row names 
of the included data frame for SpatialPolygonsDataFrame objects.

Roger


>
> Thank-you for your time and help,
> Levi
>
>

-- 
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: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list