-1

I have downloaded the Canada census level polygon shapefiles strong text (https://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-2011-eng.cfm) and imported into R using readOGR function from rgdal package.

However, I am struggling to extract the shapefiles specifically from British Columbia. I have used some of the previous explanations to extract my US state zip codes with success (Choropleth Maps in R - TIGER Shapefile issue).

I need assistance in extracting the BC shapefiles.

UseR10085
  • 7,120
  • 3
  • 24
  • 54
kitkat23
  • 35
  • 6

1 Answers1

1

I don't know which Geographic area or water feature you have selected from that website. I have downloaded the Digital Boundary File of Provinces/territories. I have read and subsetted British Columbia shapefile using following command

library(rgdal)

df <- readOGR(dsn = "C:\\Users\\User\\Desktop\\gpr_000a11a_e", layer = "gpr_000a11a_e")

#To see the data head
head(df@data)

#To see a particular column of the shapefile
df@data$PRENAME

#Subsetting British Columbia from the shapefile
BC = subset(df, PRENAME=="British Columbia")

#Plotting it
plot(BC)
UseR10085
  • 7,120
  • 3
  • 24
  • 54