SpatialRingsDataFrame-class {sp} | R Documentation |
class to hold polygons with attributes
Objects can be created by calls to the function SpatialRingsDataFrame
data
:"data.frame"
; attribute table polygons
:"list"
; see SpatialRings-class plotOrder
:"integer"
; see SpatialRings-class bbox
:"matrix"
; see Spatial-classproj4string
:"CRS"
; see CRS-class
Class "SpatialRings"
, directly.
Class "Spatial"
, by class "SpatialRings"
.
No methods defined with class "SpatialRingsDataFrame" in the signature.
SpatialRingsDataFrame
with default ID matching checks the data frame row names against the Srings ID slots. They must then agree with each other, and be unique (no Srings objects can share IDs); the data frame rows will be re-ordered if needed to match the Srings IDs.
data(ncshp) nc1 <- as.SpatialRings.Shapes(nc.shp$Shapes, as.character(nc.shp$att.data$FIPS)) df <- nc.shp$att.data rownames(df) <- as.character(nc.shp$att.data$FIPS) identical(rownames(df), getSRSringsIDSlots(nc1)) ncSRDF <- SpatialRingsDataFrame(nc1, df) names(as(ncSRDF, "data.frame")) identical(rownames(as(ncSRDF, "data.frame")), getSRSringsIDSlots(ncSRDF)) rrt <- as(ncSRDF, "data.frame")$SID74/as(ncSRDF, "data.frame")$BIR74 brks <- quantile(rrt, seq(0,1,1/7)) cols <- grey((length(brks):2)/length(brks)) dens <- (2:length(brks))*3 plot.SpatialRings(ncSRDF, col=cols[findInterval(rrt, brks, all.inside=TRUE)]) plot.SpatialRings(ncSRDF, density=dens[findInterval(rrt, brks, all.inside=TRUE)])