Shell command review
Repo shell_practice contains a zipped folder organize_me
with files you may have if you run a simulation on a high performance computer. Organize the contents in organize_me
using the command line according to the following rules:
.input2
files,flags
folder and all of its contents,test-data
,.sh
files in a folder named shell-scripts
,.R
files in a folder named R-scripts
,.qsub
files in a folder named hpc-run
,organize_me
to simulation
.# assuming you are in organize_me/
rm *.input2
rm -rf flags/
mkdir test-data/
mv testdata*.txt test-data/
mkdir shell-scripts/
mv *.sh shell-scripts/
mkdir R-scripts/
mv *.R R-scripts/
mkdir hpc-run/
mv *.qsub hpc-run/
cd ../
mv organize_me/ simulation/
Create a Makefile
for the R project in the learn_make repository on GitHub. The target goal should be learn_make.html
.
The following steps will guide you in the fileโs development.
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 data, respectively.
Revise your Makefile
with built-in variables or other useful features.
.PHONY: all
all: learn_make.html
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 $<
.PHONY: clean_html clean_data
clean_html:
rm learn_make.html
clean_data:
cd data; rm *.rds