This project contains an R Shiny application and a GitHub Pages wrapper site.
It replicates the material developed by Dani Arribas-Bel (@darribas) and Mark Green (@markalangreen).
GitHub Pages is static hosting and cannot run an R Shiny server directly.
Deployment pattern used here:
- Deploy the Shiny app to a Shiny-capable host (e.g. shinyapps.io, Posit Connect, or your own Shiny Server).
- Use GitHub Pages (
docs/) as a static front-end that embeds that deployed app URL.
install.packages(c("shiny", "sf", "dplyr", "readr", "leaflet", "scales", "htmltools"))
shiny::runApp(".")The repo does not keep large GeoPackage binaries in Git history.
Required file:
data/inputs/oac21.gpkg
If missing, app startup and helper script can download it using env var:
CENSUS_MAPPING_OAC21_GPKG_URL
Example:
export CENSUS_MAPPING_OAC21_GPKG_URL="https://<your-hosted-file>/oac21.gpkg"
Rscript scripts/get_data.RDropbox note:
- Use a shared link for
oac21.gpkg; the bootstrap script auto-converts Dropbox preview links (dl=0) to direct download (dl=1). - Example:
export CENSUS_MAPPING_OAC21_GPKG_URL="https://www.dropbox.com/scl/fi/<id>/oac21.gpkg?dl=0"
Rscript scripts/get_data.R- Deploy your Shiny app and copy its public URL.
- Edit
docs/config.jsand set:
window.CENSUS_MAPPING_CONFIG = {
SHINY_APP_URL: "https://<your-shiny-hosted-app-url>",
TITLE: "Census Mapping"
};- Push to GitHub.
- In GitHub repo settings: Pages -> Source:
Deploy from a branch-> Branch:main/ Folder:/docs. - Your Pages URL will serve the wrapper site and embed the live Shiny app.
app.R: Shiny appscripts/data_bootstrap.R: runtime data checks/download helperscripts/get_data.R: manual data bootstrap helperdocs/index.html: GitHub Pages static wrapperdocs/config.js: wrapper configuration (set embedded Shiny URL)www/styles.css: app styling