-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
63 lines (40 loc) · 1.86 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
echo = FALSE
)
```
# 2022 ACS update + community profiles
Distribution-ready files are in [`to_distro`](to_distro). CSV file for populating website's community profiles is in [`website`](website).
## Output
```{r comment=""}
files <- data.frame(file = paste(".", list.files(c("fetch_data", "output_data", "to_distro", "website"), full.names = TRUE), sep = "/"))
print(data.tree::FromDataFrameTable(files, pathName = "file"))
```
## Development
Several global functions and other objects are loaded when each script sources `utils/pkgs_utils.R`, including all loaded libraries. There are two global variables for years: `yr` and `cws_yr`, for the ACS endyear and the CWS year, respectively. Those are both taken as positional arguments by `pkgs_utils.R` and passed down to whatever script you want to run.
For example, on the command line run:
```bash
Rscript scripts/03_calc_acs_towns.R 2022 2021
```
to execute that script for ACS year 2022 & CWS year 2021. Similarly, those 2 variables are saved in the makefile / snakefile and passed to scripts from there.
To build the full project in the proper order, on the command line run:
```bash
snakemake all --cores 2 # or more cores if you can
```
or rebuild just once piece of it, e.g. `snakemake prep_distro --cores 2`.
Calling `snakemake testvars --cores 2` will verify what years are being used by sourcing just `utils/pkgs_utils.R`.
Additionally, this repo has a release of data in order to have a single source of the year's ACS data for other projects.
To create and upload the release, run:
```bash
snakemake release --cores 2
```
```{bash include=FALSE}
snakemake --filegraph | dot -T png > dag.png
```
![snakefile](dag.png)