subset.polylist {maptools}R Documentation

Subset polygon list objects

Description

The function subsets a polygon list object, also subsetting region ID attributes and also map limits if required.

Usage

## S3 method for class 'polylist':
subset(x, subset, fit.bbox = TRUE, ...)

Arguments

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

Value

returns a polylist object, lists of polygon boundary coordinates (divided by NA where the polygon object is represented by more than one polygon);

Author(s)

Roger Bivand Roger.Bivand@nhh.no

Examples

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)

[Package maptools version 0.6-9 Index]