-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
109 lines (84 loc) · 3.3 KB
/
makefile
File metadata and controls
109 lines (84 loc) · 3.3 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# ==============================================================================
#
# [ PROJ ] Digital redlining: the relevance of 20th century housing policy to
# 21st century broadband access and education
# [ FILE ] makefile
# [ AUTH ] Benjamin Skinner (@btskinner), Hazel Levy, & Taylor Burtch
# [ INIT ] 18 January 2023
#
# ==============================================================================
# --- directories --------------------------------
DAT_DIR := data
DOC_DIR := docs
FIG_DIR := figures
SCR_DIR := scripts
# --- variables ----------------------------------
# data vars
init_acs_data := $(DAT_DIR)/clean/acs_2015_2019_seq_135_sumlvl_140_us.RDS
init_fcc_data := $(DAT_DIR)/clean/broadband_bg.RDS
init_geo_data := $(DAT_DIR)/clean/sf_tr_holc.RDS
analysis_acs_data := $(DAT_DIR)/clean/holc_acs_analysis.RDS
analysis_fcc_data := $(DAT_DIR)/clean/holc_fcc_analysis.RDS
# output vars (one example: assumes one change is all change)
acs_output := $(DAT_DIR)/clean/predictions_acs.RDS
fcc_output := $(DAT_DIR)/clean/predictions_fcc.RDS
fig_output := $(FIG_DIR)/inc_cbb_line.pdf
doc_output := figtab.pdf
# --- build targets ------------------------------
all: setup data analysis figures docs
acs_data_init: $(init_acs_data)
fcc_data_init: $(init_fcc_data)
acs_data_clean: $(analysis_acs_data)
fcc_data_clean: $(analysis_fcc_data)
geo_data: $(init_geo_data)
acs_data: acs_data_init acs_data_clean
fcc_data: fcc_data_init fcc_data_clean
data: acs_data fcc_data geo_data
acs_analysis: $(acs_output)
fcc_analysis: $(fcc_output)
analysis: acs_analysis fcc_analysis
figures: $(fig_output)
docs: $(doc_output)
.PHONY: all setup data analysis figures docs
# --- packages -----------------------------------
setup:
@echo "Checking for and installing necessary R packages"
Rscript $(SCR_DIR)/r/check_packages.R .
# --- make data ----------------------------------
$(init_acs_data): $(SCR_DIR)/r/make_data_acs.R
@echo "Initializing ACS analysis data"
Rscript $< .
$(init_fcc_data): $(SCR_DIR)/r/make_data_fcc.R
@echo "Initializing FCC analysis data"
Rscript $< .
$(init_geo_data): $(SCR_DIR)/r/make_data_geo.R $(init_acs_data) $(init_fcc_data)
@echo "Initializing geography analysis data"
Rscript $< .
$(analysis_acs_data): $(SCR_DIR)/r/clean_data_acs.R $(init_acs_data) $(init_geo_data)
@echo "Cleaning ACS analysis data"
Rscript $< .
$(analysis_fcc_data): $(SCR_DIR)/r/clean_data_fcc.R $(int_fcc_data) $(init_geo_data)
@echo "Cleaning FCC analysis data"
Rscript $< .
# --- analysis -----------------------------------
$(acs_output): $(SCR_DIR)/r/analysis_acs.R $(analysis_acs_data)
@echo "Running Bayesian models for ACS data"
Rscript $< .
$(fcc_output): $(SCR_DIR)/r/analysis_fcc.R $(analysis_fcc_data)
@echo "Running Bayesian models for FCC data"
Rscript $< .
# --- tables & figures ---------------------------
$(fig_output): $(SCR_DIR)/r/make_figures.R $(acs_output) $(fcc_output)
@echo "Making figures"
Rscript $< .
# --- docs ---------------------------------------
$(doc_output):
@echo "Compiling figures document"
cd docs && pandoc $(@:.pdf=.md) \
--read=markdown \
--write=latex \
--output=$@ \
--resource-path=..:../figures
# ------------------------------------------------------------------------------
# end makefile
# ==============================================================================