0

I am trying to filter specific zones from this shapefile. The shapefile contains traffic zones from the 2016 TTS survey for the entire GTHA. I downloaded the shapefile from here: http://dmg.utoronto.ca/survey-boundary-files#2006_zone.

I am only interested in zones within Hamilton (5001-5252). I am having trouble with the code.

I am able to plot the shapefile, but cannot filter the zones that I am interested in to plot. I have loaded dplyr and sf packages, and tried using the code below:

hamilton <- gtha %>% filter(GTA06 >=5001 & GTA06 <=5252)

I keep getting the following message:

Error: object 'GTA06' not found

lrnr33
  • 1
  • Possible duplicate of [How to subset a shapefile](https://stackoverflow.com/questions/25985395/how-to-subset-a-shapefile) – johnny1995 Jun 07 '19 at 20:32
  • Without us having to download and read in the whole shapefile, are you certain that GTA06 is a column in an object that could be used with `filter`, e.g. an `sf` object? – camille Jun 07 '19 at 20:36
  • How did you read the shapefile? What is the class of `gtha`? Are you using `sp` of `sf` package? Are you sure `GTA06` is the name of an attribute? Please edit your question to make it answerable. – JRR Jun 07 '19 at 20:37

0 Answers0