# load packages used in this example
library(sifr)
library(sf)
library(mapview)
In this illustration, I provided some example usage for the
sifr
package. Some sociodemographic and built environment
variables are calculated for a small random sample of schools in
Toronto. Throughout this example, I used projection NAD83 / UTM Zone 18N
(EPSG:26918).
All types of School Locations in Toronto
# school locations in Toronto
schools <- st_read("./../extdata/toronto_schools.gpkg", quiet = T)
# force the geometry column to name geometry
st_geometry(schools) <- "geometry"
# for reproductivity
set.seed(123)
# take a random 30 sample to simplify calculation as this is just an example
schools <- schools[sample(1:nrow(schools), 30),]
mapview(schools)
Some variables of interest
# road intersections in Toronto
intersections <- st_read("./../extdata/centreline_intersection.gpkg", quiet = T)
# force the geometry column to name geometry
st_geometry(intersections) <- "geometry"
# road centrelines in Toronto
roads <- st_read("./../extdata/centreline.gpkg", quiet = T)
# force the geometry column to name geometry
st_geometry(roads) <- "geometry"
# 2021 Canadian census data
census_data <- readRDS("./../data/census_data.rds")
# land use data in Toronto
landuse <- st_read("./../extdata/landuse.shp", quiet = T)
mapview(landuse, zcol="Class_name")