[R-sig-Geo] How to extract part of Map object using maptools

Roger Bivand Roger.Bivand at nhh.no
Thu Nov 20 14:25:41 CET 2003

On Thu, 20 Nov 2003, Hisaji Ono wrote:

> Hi.
>  Rmap can extract parts of Map object as follows.

Rmap has a nice "proxy" view of the data file, which is not read in until 
needed. So it implements subsetting during the read action (shapefile() 
just checks that the file exists and can be opened by the declared 

>  columbus<- shapefile("columbus.shp") " load shapefile
>  plot(columbus[columbus$CRIME > mean(columbus$CRIME)]) # filter by attribute
> & plot
>  But I don't know how to do this by maptools.

In maptools it could be implemented by writing a subset tool for either 
Map or polylist objects, but just running subset() on a polylist will not 
work directly, because the new list does not have the correct class. But 
it isn't difficult, I'll add it to the next maptools release. How should 
the bounding box be handled, should it be left as is, or reduced to suit 
the subset?


>  Regards.
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-geo

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no

More information about the R-sig-Geo mailing list