This repository contains a reproducible pipeline for analyzing air quality data collected in an Italian city from March 2004 to February 2005. The dataset includes hourly measurements of air pollutants and meteorological conditions. The analysis focuses on cleaning the data, summarizing key variables, visualizing patterns, and building regression models to predict benzene levels.
This project performs the following steps:
- Data Cleaning (
code/00_clean_data.R) - Descriptive Summary Table (
code/01_make_table.R) - Visualizations (
code/02_make_plot.R) - Modeling (
code/03_make_model.R) - Final Report Rendering (
code/04_render_report.R)
All scripts save their outputs in the output/ directory. The final report is rendered as final_report.html in the final_report/ directory.
This project uses renv to ensure package reproducibility.
- Before building the project, confirm that you has the
renvpackage installed, run the following code in Console:
"renv" %in% row.names(installed.packages())If the above command returns FALSE, install the renv package using install.packages("renv") in Console.
- Install necessary R packages (if needed):
install.packages(c("here", "tidyverse", "yaml", "kableExtra", "gtsummary", "ggcorrplot", "gt", "broom.helpers", "cardx", "car", "parameters"))- Restore package environment using the
renv.lockfile:
make install- Clean previous outputs (optional):
make clean- Build the full project and generate
final_report/final_report.html:
makeThis project includes a Dockerfile that builds an image to fully reproduce the analysis inside a containerized environment.
You can pull the image directly from DockerHub:
docker pull youweihu/final_project_imageRun the pipeline inside a container with:
make docker_runThis will:
- Mount your local final_report/ directory
- Execute the full workflow inside the container
- Output final_report.html into your local final_report/ folder
If you'd like to rebuild the image yourself instead of using DockerHub (you must have Docker installed):
docker build -t final_project_image .or simply:
make build_image