Hi Lin, I think you can simply do your selection as with any dataframe, e.g.
require(rgdal) Ctries=readOGR(dsn='C:/data/datasets/HornOfAfrica', layer='HornOfAfrica', p4s=NULL) str([EMAIL PROTECTED]) try<-Ctries[Ctries$AREA>100,] spplot(try, zcol='ADM0_CODE') # or: Kenya<-Ctries[Ctries$ADM0_NAME=='Kenya',] spplot(Ctries, zcol='ADM0_CODE',sp.layout=list(list("sp.polygons",Kenya, col="red")), scales=list(draw=TRUE), xlim=c(30,52), ylim=c(-10,18), col.regions='transparent', colorkey=FALSE) Hope this helps, Friderike -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Xin LIN Sent: 05 September 2008 10:07 To: r-sig-geo@stat.math.ethz.ch Subject: [R-sig-Geo] How to remove polygons according to their attributes? Hi, everyone I have a shapefile with many adjacent polygons in. Each has a series of attributes such as ID and area. Now I want to remove some of them based on attributes, e.g. to remove polygons with areas less than a given value. How can I proceed? Thanks a lot.=) Lin Xin -- Lin Xin Department of Ecology, College of Urban and Environmental Sciences Peking University Beijing 100871, China Tel: +8610 62765578 Mobile: +86 15801416516 Email: [EMAIL PROTECTED] [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo