[R] data.frame to shape

Leonardo Lami lami at faunalia.it
Wed Aug 9 15:32:41 CEST 2006


Hi all,
I have a simple question:
I have a data.frame like this:

   id       x       y
1  50 1647685 4815259
2  50 1647546 4815196
3  50 1647454 4815294
4  50 1647405 4815347
5  50 1647292 4815552
6 50 1647737 4815410
7 74 1647555 4815201
8 74 1647464 4815023
9 74 1646970 4815129
10 74 1646895 4815264
11 74 1646762 4815513

and I'd like to trasform it with the "convert.to.shapefile" function 
(shapefiles package) but to make this I must have a data.frame like this:

   id       x       y
1  50 1647685 4815259
2  50 1647546 4815196
3  50 1647454 4815294
4  50 1647405 4815347
5  50 1647292 4815552
6  50 1647737 4815410
7  50 1647685 4815259
8  74 1647555 4815201
9  74 1647464 4815023
10 74 1646970 4815129
11 74 1646895 4815264
12 74 1646762 4815513
13 74 1646762 4815513

with the first point of every id repeated to close the polygon.
There is a function to make this indipendently by the number of the id

Best regards
Leonardo

-- 
Leonardo Lami
email + jabber: lami at faunalia.it
www.faunalia.it
Cell: (+39)349-1310164  Tel+Fax: (+39) 0587-213742
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy



More information about the R-help mailing list