Exercise 1

Problem

Navigate to directory cl-demo/. Explore and map out everything in cl-demo/. Draw a tree diagram as in the slide titled Path Diagram.

Solution

You should see there exists a README.md and three directories: data/, scripts, and simulation.

In data/ we have cars.txt, diamonds.txt, and mtcars.txt. In scripts/ we have generate_data.R, plot_data.R, summarise_data.R. In simulation/ we have 592 .txt files.

Exercise 2

Problem

Create two new folders in cl-demo/simulation/ with names p500 and p1000. Move all simulation results with parameter \(p\) being 500 to folder p500/. Similarly, move all simulation results with parameter \(p\) being 1000 to folder p1000/.

Solution

Assuming you start in cl-demo/, the commands would be

cd simulation/          # navigate to folder simulation/
mkdir p500 p1000        # create 2 new directories
mv *p500*.txt p500      # move p500 files
mv *p1000*.txt p1000    # move p1000 files

Exercise 3

Problem

Which flag associated with the shell command rm allows you to delete a directory containing files?

Solution

Flags -r, -R, --recursive allow you to remove directories and their contents recursively. Flags -d and --dir only allow you to remove empty directories.