An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110705/73fb0491/attachment.pl>
Using rbind with SpatialLinesDataFrame
2 messages · Jonathan Callahan, Edzer Pebesma
Please try: row.names(basin1) = 2029:4682 row.names(basin2) = 1:2028 rbind(basin1, basin2)
On 07/05/2011 08:13 PM, Jonathan Callahan wrote:
I have a rather large dataset of watershed data stored as a SpatialLinesDataFrame. I can plot and subset the data just fine. In an effort to speed up plotting times I have broken up the watershed into separate basins so that I can load and plot only those basins in my region of interest. (This improves performance quite a lot.) I would like to use "subWatershed = rbind(basin1,basin2,...)" to reconstitute a single SpatialLinesDataFrame from just a few of the basins. My problem is that the row.names in the sub-basins retain the row.names from the original dataset: rownames(basin1 at data) = 2029:4682 rownames(basin2 at data) = 1:2028 When I use rbind(basin1,basin2) I get the following error: Error in SpatialLinesDataFrame(ll, df) : row.names of data and Lines IDs do not match If I reverse the ordering and use rbind(basin2,basin1) everything is OK but I want to do this reconstitution programmatically. I won't know ahead of time which basins are involved or what their ordering is. In the future I might also use basins from adjacent watersheds which have separate numbering schemes. Can anyone explain to me what exactly this error means and how I might resolve it? Thanks in advance, Jon
Edzer Pebesma Institute for Geoinformatics (ifgi), University of M?nster Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de http://www.52north.org/geostatistics e.pebesma at wwu.de