View source: R/poly2SpatialPolygons.R
| poly2SpatialPolygons | R Documentation | 
SpatialPolygons objectThis function takes a simple polygon and attempts to
convert it to a SpatialPolygons object.
This list is assumed to have components x and
y that define the boundary of the polygon.
poly2SpatialPolygons(x, ID = "border")
x | 
 A list with components   | 
ID | 
 The name of the resulting polygon.  Default is
  | 
A SpatialPolygons object
Joshua French
angle = seq(0, 2 * pi, len = 100)
poly = list(x = cos(angle), y = sin(angle))
plot(poly, type = "l", asp = 1)
sppoly = poly2SpatialPolygons(poly)
library(sp)
plot(sppoly, axes = TRUE, asp = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.