forked from rossb34/PortfolioAnalyticsPresentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
67 lines (50 loc) · 1.88 KB
/
makefile
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
# http://robjhyndman.com/hyndsight/makefiles/
# https://www.cs.umd.edu/class/fall2002/cmsc214/Tutorial/makefile.html
# List the R files used
RFILES := data_prep.R data_analysis.R optimize.R optimization_analysis.R
# Rout indicator files to show R file has run
# R CMD BATCH will generate .Rout files after running
OUT_FILES:= $(RFILES:.R=.Rout)
all: $(OUT_FILES) index.html presentation.Rmd
index.html: presentation.Rmd
Rscript -e "library(methods); library(slidify); slidify('presentation.Rmd')"
mv presentation.html index.html
# Generate slidy presentation from markdown file
slidy_presentation.html: $(RFILES) $(OUT_FILES) presentation.md
pandoc -t slidy -s --mathjax presentation.md -o slidy_presentation.html
# Generate slidy presentation from markdown file
slides.pdf: $(RFILES) $(OUT_FILES) presentation.md
pandoc -t -S beamer —-slide-level 2 presentation.md -o slides.pdf
# Generate markdown file from R markdown file
presentation.md: presentation.Rmd
Rscript -e "library(knitr); knit('presentation.Rmd')"
# Data analysis script
data_analysis.Rout: data_analysis.R
R CMD BATCH --vanilla data_analysis.R
# Optimization analysis script to analyze results of optimization
optimization_analysis.Rout: optimization_analysis.R optimize.R
R CMD BATCH --vanilla optimization_analysis.R
# Run optimizations
optimize.Rout: optimize.R
R CMD BATCH --vanilla optimize.R
# Data prep
data_prep.Rout: data_prep.R
R CMD BATCH --vanilla data_prep.R
lwShrink.Rout: R/lwShrink.R
R CMD BATCH --vanilla R/lwShrink.R
charting.Rout: R/charting.R
R CMD BATCH --vanilla R/charting.R
# Use Rscript to run the necessary R files as an alternative to R CMD BATCH
runR:
Rscript data_prep.R
Rscript data_analysis.R
Rscript optimize.R
Rscript optimization_analysis.R
clean:
rm -f *.Rout
rm -f figures/*.png
rm -f optimization_results/*.rda
rm -f presentation.md
rm -f *.html
rm -rf libraries/
rm -rf .cache/