Create a Makefile for the R project in the learn_make repository on GitHub. The target goal should be learn_make.html. The below steps will help guide you in creating Makefile.
Diagram the dependency structure on paper.
First, create a Makefile that only knits the Rmd file and produces the learn_make.html file.
Next, add rules for the data dependencies.
Add phony clean_html and clean_data targets that delete the html file and delete the rds files in data/, respectively.
Revise your Makefile with built-in variables or other useful features.
If you copy this solution to your Makefile, be sure that tabs preceded the recipes. If you see Makefile: *** missing separator. Stop., make is most likely letting you know that the indented lines have been made with something other than a tab.
learn_make.html: learn_make.Rmd data/ok_tor.rds data/fire_stations.rds data/school_districts.rds
Rscript -e "library(rmarkdown); render('learn_make.Rmd')"
data/ok_tor.rds: R/get_tornadoes.R
Rscript $<
data/fire_stations.rds: R/get_fire_stations.R
Rscript $<
data/school_districts.rds: R/get_school_districts.R
Rscript $<
clean_html:
rm learn_make.html
clean_data:
cd data; rm *.rds
.PHONY: clean_html clean_data