polygons {sp} | R Documentation

## sets spatial coordinates to create spatial data, or retrieves spatial coordinates

### Description

sets spatial coordinates to create spatial data, or retrieves spatial coordinates

### Usage

            polygons(obj)
            polygons(object) <- value

### Arguments

`obj` | object of class "SpatialPolygonsDataFrame"
`object` | object of class "data.frame"
`value` | object of class "SpatialPolygons"

### Value

polygons returns the SpatialPolygons of obj; polygons<- promotes a data.frame to a SpatialPolygonsDataFrame object

### Examples

    data(ncshp)
    nc1 <- as.SpatialPolygons.Shapes(nc.shp$Shapes, as.character(nc.shp$att.data$FIPS))
    df <- nc.shp$att.data
    rownames(df) <- df$FIPS
    polygons(df) <- nc1
    class(df)

[Package sp version 0.7-12 Index]