Initial commit: illustrative R data pipeline

This commit is contained in:
2026-03-09 14:20:10 -04:00
commit 83e50d2c36
12 changed files with 277 additions and 0 deletions

25
main.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# main.sh — pipeline caller
# Runs each R script in order via the rstudio Docker container.
# Equivalent to a PowerShell script that calls macros sequentially.
#
# To schedule this automatically, add a cron entry:
# 0 8 * * 1 /data/projects/r/powershell_example/main.sh >> /tmp/pipeline.log 2>&1
# That runs the pipeline every Monday at 8am.
set -e # stop on any error
WORKDIR="/data/projects/r/powershell_example"
echo "=== Pipeline start: $(date) ==="
docker exec -w "$WORKDIR" rstudio Rscript scripts/01_create_data.R
docker exec -w "$WORKDIR" rstudio Rscript scripts/02_validate.R
docker exec -w "$WORKDIR" rstudio Rscript scripts/03_convert_currency.R
docker exec -w "$WORKDIR" rstudio Rscript scripts/04_pivot_income.R
docker exec -w "$WORKDIR" rstudio Rscript scripts/05_convert_units.R
docker exec -w "$WORKDIR" rstudio Rscript scripts/06_merge.R
docker exec -w "$WORKDIR" rstudio Rscript scripts/07_calc.R
docker exec -w "$WORKDIR" rstudio Rscript scripts/08_format.R
echo "=== Pipeline complete: $(date) ==="