On Tue, 09 Nov 2010 21:19:45 +0100, Edzer Pebesma wrote: > On 11/09/2010 09:05 PM, Lee Hachadoorian wrote: >> >> row.names(spdf) = as.character(spdf$key_field) sp = as(spdf, >> "SpatialPolygons") >> row.names(df) = df$key_field >> spdfNew = SpatialPolygonsDataFrame(sp, df, match.ID = TRUE) > > It would be rather trivial to make the following work: > > spdfNew = SpatialPolygonsDataFrame(sp, df, match.ID = "key_field") > > which would do the same as the last two of your commands.
match.ID is a logical, not a field name, so that doesn't work. From the documentation: "match.ID logical: (default TRUE): match SpatialPolygons member Polygons ID slot values with data frame row names, and re-order the data frame rows if necessary" --Lee -- Lee Hachadoorian PhD Student, Geography Program in Earth & Environmental Sciences CUNY Graduate Center -- Lee Hachadoorian PhD Student, Geography Program in Earth & Environmental Sciences CUNY Graduate Center _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo