I believe Peter figured it out on his own off list. Here was my solution using rgdal:
library(rgdal) # Shapefile's full path is '/home/matt/LynchingHotSpots. shp' on my computer # If you had your file at 'C:\data\LynchingHotSpots.shp' you would change # shpFolder to "C:/data" and shpLayer stays as "LynchingHotSpots" shpFolder <- "/home/matt" shpLayer <- "LynchingHotSpots" spdf <- readOGR(shpFolder,shpLayer,p4s="+proj=longlat +datum=NAD27") spdf # SpatialPolygonsDataFrame # Pick out the states of interest statesWanted <- c("Mississippi","Louisiana","Alabama","Tennessee","Georgia","South Carolina","North Carolina","Kentucky") subSpdf <- spdf[spdf$STATE_NAME %in% statesWanted,] # Original vs. Subsetted dim(spdf) # 3141 by 16 dim(subSpdf) # 733 by 16 spplot(spdf,"Lynchings") # original spplot(subSpdf,"Lynchings") # subsetted # Create pdf of results pdf("LynchingResults.pdf") spplot(subSpdf,"Lynchings") dev.off() Matt Beard Purdue University On Mon, May 31, 2010 at 12:18 AM, Don MacQueen <m...@llnl.gov> wrote: > > Supposing that your data object is named "mydata", try following this > example: > > mydata[ , STATE_NAME %in% c('name1','name2','name17') ] > > replacing my fake state names with the ones you want. > > If you have another variable that identifies the subset you want, use it > instead of STATE_NAME. > > This example assumes you data is in a SpatialPolygonsDataFrame. > > You haven't really provided enough information for more specific > suggestions. > > -Don > [[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