https://github.com/btskinner/batch_reports
An example of how batch process reports with Bash and knitr
https://github.com/btskinner/batch_reports
bash batch-processing knitr r reports
Last synced: 3 months ago
JSON representation
An example of how batch process reports with Bash and knitr
- Host: GitHub
- URL: https://github.com/btskinner/batch_reports
- Owner: btskinner
- Created: 2019-02-03T17:48:03.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-03T18:26:06.000Z (almost 7 years ago)
- Last Synced: 2025-08-27T02:47:01.495Z (4 months ago)
- Topics: bash, batch-processing, knitr, r, reports
- Language: R
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Batch processing reports with Bash + knitr
This process uses a combination of Bash scripting and
[knitr](https://yihui.name/knitr/) to batch process state-specific
reports. The specific example used shows state-level unemployment
trends from 2000 to 2016. All numbers come from the [Bureau of Labor
Statistics county-level
estimates](https://www.btskinner.me/data/bls-unemployment/) that have
been aggregated to various levels, using labor force size as weights.
Each state will get its own report that contains:
1. A line plot showing the state-level unemployment rate change from
2000 to 2016 as well as comparision lines for the state's census
region and the United States as a whole. While the national line
will be the same in each report, the region and state lines will
change based on the state.
2. A table showing the same numbers used in the plot as well as
columns showing the difference between the state's rates and those
of the nation and the region.
## To run
Clone this directory, `cd` into the `scripts` directory, and run the
following scripts in order:
1. `get_data.r`
- downloads necessary data files
2. `munge_data.r`
- converts data files into format needed for reports
3. `run_reports.sh`
- knits each state-level report, creating necessary subdirectories
as needed
- `-d` option is used to set the top-level directory (should be
`../` unless you change the directory structure, which is not
recommended).
- `-t` option is the name of the template file, without path
(should be `template.rnw` unless you change the template file
name).
```bash
git clone
cd ./bulk_reports/scripts
Rscript get_data.r
Rscript munge_data.r
./run_reports -d ../ -t template.rnw
```