I would like to create some statistical profiles for a range of features; specifically, 2016 Census profiles for the Census Divisions (CD) within British Columbia (BC), Canada. This would require a map showing each CD highlighted with respect to the other CDs (28 in total).
To do this using the
sf package in R and the Statistics Canada Boundary files for 2016 Census Divisions (ZIP format) [~32MB]
I would follow these pseudo-code steps:
- Load the source
- Filter on BC (
PRUID = 59)
- Select the first feature/CD
- Plot the entire set of features (black line with white fill)
- Plot (with
add = TRUE) the selected CD with some colour (black line with coloured fill)
- Move to/select next feature/CD and go to Step 4
How would I code this in R?
The idea would be to generalize this so one can cycle through any set of features within a shapefile and output individual features highlighted within the entire geography.