MPV Data Analysis - Auto-Updating Blog Post
Overview
This blog post automatically updates whenever the website is rebuilt. It downloads the latest data from Mapping Police Violence and regenerates all visualizations.
How It Works
- R Markdown: The post is written in R Markdown (
index.Rmd), which contains both text and R code - Automatic Download: When the site builds, the R code downloads the latest MPV Excel file
- Data Processing: The code cleans and analyzes the data
- Visualization Generation: All charts are generated fresh with the latest data
- HTML Output: The
.Rmdfile is knitted toindex.html, which is then served by Hugo
Build Process
When you rebuild your website (either locally or via Netlify):
- Hugo/blogdown processes all
.Rmdfiles - The R code chunks execute in order
- Fresh data is downloaded from:
https://mappingpoliceviolence.us/s/MPVDatasetDownload.xlsx - Visualizations are created and embedded in the post
- The HTML output includes the latest data and charts
Key Features
Data Disclaimers
The post includes prominent warnings that:
- This data captures killings only, not all uses of lethal force
- Most police shootings are survived, so these numbers undercount total incidents
- The statistics are descriptive only and don’t establish causation
Automatic Updates
- No manual intervention needed - just rebuild the site
- Data is always current as of the last build
- Date stamps update automatically
Comprehensive Analysis
Includes visualizations for:
- Cumulative trends (all deaths and shootings only)
- Demographic patterns (race, age)
- Behavioral context (armed status, mental health)
- Temporal patterns (seasonal, day of week)
- Geographic distribution (maps, states, cities)
- Per capita rates
- Accountability and socioeconomic factors
Required R Packages
The analysis requires:
- tidyverse
- readxl
- lubridate
- gghighlight
- ggthemes
- ggrepel
- slider
- sf
- rnaturalearth
- rnaturalearthdata
These should be installed in your R environment where the site builds.
Customization
To modify the analysis:
- Edit
index.Rmd - Rebuild the site locally to test:
blogdown::serve_site() - Commit and push changes
Data Source
Data automatically downloaded from: Mapping Police Violence: https://mappingpoliceviolence.org/
The database is continuously updated and currently includes data through 12/31/2025.
Notes
- The download happens at build time, so there’s a brief delay
- The
.Rmdfile hascache=FALSEon the download chunk to ensure fresh data - All file paths are temporary to avoid cluttering the repository
- Visualizations are embedded directly in the HTML (no separate image files needed)