Skip to content
Prev 2092 / 29559 Next

modifying shpfiles in maptools

On Thu, 24 May 2007, Markus Loecher wrote:

            
Yes, the Map object structure is too close to the input shapefile to be 
easy to manipulate. Try rather:

shpfile.CA <- readShapePoly("bg06_d00.shp")
shpfile.CA$COUNTY <- as.character(shpfile.CA$COUNTY)
shpfile.SF <- shpfile.CA[shpfile.CA$COUNTY == "075",]

should work if shpfile.CA$COUNTY is correct - I'd do a 
table(shpfile.CA$COUNTY) first to check that the values came out right.

The examples are in maptools (and rgdal) for reading and writing, and in 
sp for manipulating and plotting - for easy plots see spplot().

Roger