mackaszechno 27 February 2026
see https://rmarkdown.rstudio.com/github_document_format.html for reference here to creating github document (rmarkdown custom template)
| # check if geometry col is 'geom' and rename | |
| rename_geom_col_as_geometry <- function(x){ | |
| if(attr(x, "sf_column") == "geom"){ | |
| st_geometry(x) <- "geometry" | |
| } | |
| return(x) | |
| } | |
| filter_dictionaries <- function(filtering_postcode, |
| as_the_crow_flies <- function(i){ | |
| st_distance(all_pupils_sf[i,], | |
| all_schools_sf[ | |
| all_schools_sf$nativeid == all_pupils_sf[i,]$nativeid, ], | |
| by_element = TRUE) | |
| } |
| `%nin%` <- Negate(`%in%`) | |
| read_and_merge_osaddressbase <- function(folder_date, # = "2024-08" | |
| filename, # = "6581692" | |
| stub = "D:/data_store/OS.ADDRESSBASE/", | |
| ext = ".gpkg"){ | |
| # merge two layers we need so we can intersect by wsx boundary | |
| # where to find the geopackage and its filename | |
| gpkg <- paste0(stub, folder_date, "/", filename, ext) | |
| # add advisory |
mackaszechno 27 February 2026
see https://rmarkdown.rstudio.com/github_document_format.html for reference here to creating github document (rmarkdown custom template)
| -- GTFS Database Schema for DuckDB | |
| -- Based on GTFS Specification v2.0 | |
| -- levels.txt | |
| CREATE TABLE levels ( | |
| level_id TEXT PRIMARY KEY, | |
| level_index DOUBLE NOT NULL, | |
| level_name TEXT | |
| ); |
| library(readr) | |
| library(dplyr) | |
| library(sf) | |
| library(mapgl) | |
| # download data here: https://roadtraffic.dft.gov.uk/downloads | |
| dft <- read_csv("dft_traffic_counts_aadf_by_direction.csv", | |
| col_types = cols( | |
| count_point_id = col_double(), |
| ui <- | |
| page_sidebar( | |
| tags$head( | |
| tags$link( | |
| rel="shortcut icon", | |
| href="https://github.com/szechno/wscc_shinyapp/blob/main/favicon.ico?raw=true" | |
| ) | |
| ), | |
| theme = bs_theme(bootswatch = "simplex", |
| # preload functions ---- | |
| # server ---- | |
| server <- function(input, output, session) { | |
| # bs_themer() | |
| # selected/clicked esuid we call `v` ---- |
| library(shiny) | |
| library(shinyWidgets) | |
| library(bslib) | |
| library(mapgl) | |
| library(sf) | |
| library(stringr) | |
| library(dplyr) | |
| library(DBI) | |
| library(RSQLite) | |
| library(callr) |