subset.polylist {maptools} | R Documentation |
The function subsets a polygon list object, also subsetting region ID attributes and also map limits if required.
## S3 method for class 'polylist': subset(x, subset, fit.bbox = TRUE, ...)
x |
a polylist object |
subset |
a logical vector valued TRUE if the element is to be retained |
fit.bbox |
if TRUE (default) modifies the maplim attribute to bound the subset |
... |
other arguments passed through |
returns a polylist object, lists of polygon boundary coordinates (divided by NA where the polygon object is represented by more than one polygon);
Roger Bivand Roger.Bivand@nhh.no
nc <- read.shape(system.file("shapes/sids.shp", package = "maptools")[1]) mappolys <- Map2poly(nc, as.character(nc$att.data$FIPSNO)) submap <- subset(mappolys, nc$att.data$SID74 > 0) plot(mappolys, col="orange") plot(submap, add=TRUE, col="lightpink", forcefill=TRUE)