In the past I have encountered numerical shapefile attributes stored as
factors, not numbers.  So you would have to make the following change to
Friderike's code to select by area:

require(rgdal)
Ctries=readOGR(dsn='C:/data/datasets/HornOfAfrica', layer='HornOfAfrica',
p4s=NULL)
str(Ctries@data)

# This is the part that is different
num_area <- as.numeric(as.vector(Ctries$AREA))
try<-Ctries[num_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)

On Fri, Sep 5, 2008 at 3:07 AM, Xin LIN <linxin.pku@gmail.com> wrote:

> 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: linxin.pku@gmail.com
>
>        [[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
>

	[[alternative HTML version deleted]]


