EVOLUTION-MANAGER
Edit File: SpatialPolygonsDataFrame-class.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Class "SpatialPolygonsDataFrame"</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for SpatialPolygonsDataFrame-class {sp}"><tr><td>SpatialPolygonsDataFrame-class {sp}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Class "SpatialPolygonsDataFrame" </h2> <h3>Description</h3> <p> class to hold polygons with attributes </p> <h3>Objects from the Class</h3> <p>Objects can be created by calls to the function <a href="SpatialPolygons.html">SpatialPolygonsDataFrame</a> </p> <h3>Slots</h3> <dl> <dt><code>data</code>:</dt><dd><p>Object of class <code>"data.frame"</code>; attribute table </p> </dd> <dt><code>polygons</code>:</dt><dd><p>Object of class <code>"list"</code>; see <a href="SpatialPolygons-class.html">SpatialPolygons-class</a> </p> </dd> <dt><code>plotOrder</code>:</dt><dd><p>Object of class <code>"integer"</code>; see <a href="SpatialPolygons-class.html">SpatialPolygons-class</a> </p> </dd> <dt><code>bbox</code>:</dt><dd><p>Object of class <code>"matrix"</code>; see <a href="Spatial-class.html">Spatial-class</a></p> </dd> <dt><code>proj4string</code>:</dt><dd><p>Object of class <code>"CRS"</code>; see <a href="CRS-class.html">CRS-class</a></p> </dd> </dl> <h3>Extends</h3> <p>Class <code>"SpatialPolygons"</code>, directly. Class <code>"Spatial"</code>, by class <code>"SpatialPolygons"</code>. </p> <h3>Methods</h3> <p>Methods defined with class "SpatialPolygonsDataFrame" in the signature: </p> <dl> <dt>[</dt><dd><p><code>signature(x = "SpatialPolygonsDataFrame")</code>: select subset of (sets of) polygons; NAs are not permitted in the row index</p> </dd> <dt>rbind</dt><dd><p><code>signature(object = "SpatialPolygonsDataFrame")</code>: rbind-like method, see notes below</p> </dd> </dl> <h3>Note</h3> <p><code>SpatialPolygonsDataFrame</code> with default ID matching checks the data frame row names against the Polygons ID slots. They must then agree with each other, and be unique (no Polygons objects can share IDs); the data frame rows will be re-ordered if needed to match the Polygons IDs.. </p> <p>If you want to <code>rbind</code> objects with duplicated IDs, see<code><a href="spChFIDs-methods.html">spChFIDs</a></code>.</p> <h3>Author(s)</h3> <p>Roger Bivand</p> <h3>See Also</h3> <p><a href="SpatialPolygons-class.html">SpatialPolygons-class</a> </p> <h3>Examples</h3> <pre> # simple example, from scratch: Sr1 = Polygon(cbind(c(2,4,4,1,2),c(2,3,5,4,2))) Sr2 = Polygon(cbind(c(5,4,2,5),c(2,3,2,2))) Sr3 = Polygon(cbind(c(4,4,5,10,4),c(5,3,2,5,5))) Sr4 = Polygon(cbind(c(5,6,6,5,5),c(4,4,3,3,4)), hole = TRUE) Srs1 = Polygons(list(Sr1), "s1") Srs2 = Polygons(list(Sr2), "s2") Srs3 = Polygons(list(Sr3, Sr4), "s3/4") SpP = SpatialPolygons(list(Srs1,Srs2,Srs3), 1:3) plot(SpP, col = 1:3, pbg="white") grd <- GridTopology(c(1,1), c(1,1), c(10,10)) polys <- as(grd, "SpatialPolygons") centroids <- coordinates(polys) x <- centroids[,1] y <- centroids[,2] z <- 1.4 + 0.1*x + 0.2*y + 0.002*x*x ex_1.7 <- SpatialPolygonsDataFrame(polys, data=data.frame(x=x, y=y, z=z, row.names=row.names(polys))) brks <- quantile(z, seq(0,1,1/7)) cols <- grey((length(brks):2)/length(brks)) dens <- (2:length(brks))*3 plot(ex_1.7, col=cols[findInterval(z, brks, all.inside=TRUE)]) plot(ex_1.7, density=dens[findInterval(z, brks, all.inside=TRUE)]) </pre> <hr /><div style="text-align: center;">[Package <em>sp</em> version 1.4-2 <a href="00Index.html">Index</a>]</div> </body></html>