| 1 |
\name{polygons} |
| 2 |
\alias{polygons<-} |
| 3 |
\alias{polygons} |
| 4 |
|
| 5 |
\title{ sets spatial coordinates to create spatial data, or retrieves |
| 6 |
spatial coordinates } |
| 7 |
\description{ sets spatial coordinates to create spatial data, or retrieves |
| 8 |
spatial coordinates } |
| 9 |
\usage{ |
| 10 |
polygons(obj) |
| 11 |
polygons(object) <- value |
| 12 |
} |
| 13 |
\arguments{ |
| 14 |
\item{obj}{ object of class "SpatialPolygons" or "SpatialPolygonsDataFrame" } |
| 15 |
\item{object}{ object of class "data.frame" } |
| 16 |
\item{value}{ object of class "SpatialPolygons" } |
| 17 |
} |
| 18 |
\value{ polygons returns the SpatialPolygons of obj; polygons<- promotes a |
| 19 |
data.frame to a SpatialPolygonsDataFrame object } |
| 20 |
|
| 21 |
\examples{ |
| 22 |
grd <- GridTopology(c(1,1), c(1,1), c(10,10)) |
| 23 |
polys <- as.SpatialPolygons.GridTopology(grd) |
| 24 |
centroids <- coordinates(polys) |
| 25 |
x <- centroids[,1] |
| 26 |
y <- centroids[,2] |
| 27 |
z <- 1.4 + 0.1*x + 0.2*y + 0.002*x*x |
| 28 |
df <- data.frame(x=x, y=y, z=z, row.names=row.names(polys)) |
| 29 |
polygons(df) <- polys |
| 30 |
class(df) |
| 31 |
summary(df) |
| 32 |
} |
| 33 |
\keyword{manip} |