Module 6 - Assignments

Cross-references with Quarto & For-Loops (Bonus)

Author
Affiliation

Lars Schöbitz

ETH Zurich

Step 1: Clone your module 6 assignments repository

  1. Open github.com in your browser and navigate to the GitHub organization for the course (or use your bookmark).

  2. Find the repository md-06-assignments-USERNAME that ends with your GitHub username, and open it.

  3. Click on the green Code button.

  4. Copy the HTTPS URL to your clipboard.

  5. Open the ds4owd workspace on posit.cloud

  6. Click New Project > New Project from Git Repository

  7. Paste the HTTPS URL from GitHub into the URL of your Git Repository field.

  8. Wait until the project is deployed.

Step 2: Complete the cross-references assignment

  1. In the Files pane (bottom right), open 01a-cross-references.qmd and follow the instructions to work through the tasks.
Cross-references in Quarto

This assignment builds on the cross-references material covered in lecture 6. If you need a refresher:

  • Review the lecture slides
  • Practice with the exercises in 01a-cref-your-turn.qmd on Posit Cloud

Remember the three steps for cross-referencing:

  1. Add a caption (tbl-cap or fig-cap)
  2. Add a label starting with tbl- or fig-
  3. Reference with @tbl-... or @fig-...

Step 3: (Optional) Bonus assignment on for-loops

Bonus Assignment

This is an optional bonus assignment for students who want to deepen their understanding of iteration and for-loops in R. It is not required to complete the course, but it will help you become more proficient with R programming.

You can skip this step and proceed directly to Step 4 if you prefer.

  1. In the Files pane (bottom right), open 02a-for-loops-iteration.qmd and follow the instructions to work through the tasks.
For-Loops in R

This assignment helps you understand when for-loops are necessary and when they are not. You will learn to:

  • Distinguish between situations requiring for-loops and those that don’t
  • Write for-loops to create multiple separate outputs
  • Store plots and tables in lists
  • Debug common for-loop errors

The assignment uses global sanitation data to demonstrate practical applications of iteration.

Step 4: Commit and push your changes

  1. Navigate to the Git pane in the top-right window of RStudio

  2. Check the box next to all files to stage them for a commit

  3. Click on the Commit button. A new window opens.

  4. Enter a commit message in the Commit message field. For example: completed module 6 assignments

  5. Click on the Commit button

  6. If you see a message that confirms your commit, click on Close. If you do not see this message, make sure you have staged the files (checked the box next to them) for commit and entered a commit message.

  7. Click on the Push button in the top right corner.

  8. Enter your GitHub username and click OK

  9. Enter your GitHub Personal Access Token (PAT) in the field and click OK. This is the personal access token you created in Module 1.

If you see a message that says HEAD -> main, then you have successfully pushed your changes to the remote repository on GitHub. Click Close. If you do not see this message, make sure you have entered your GitHub username and GitHub PAT correctly.

PAT Storage Warning

If you have stored your PAT in a Word file, a blank space might have been copied along with the PAT. We recommend using a TXT file (Notepad on Windows or TextEdit on Mac) or a password manager to store your PAT securely.

Do not use your GitHub password

You need to enter the GitHub Personal Access Token (PAT) you created in Module 1 to push your changes back to GitHub.

Step 5: Open an issue on GitHub

  1. Open github.com in your browser.

  2. Navigate to the GitHub organization for the course.

  3. Find the repository md-06-assignments-USERNAME that ends with your GitHub username.

  4. You can verify here that your changes have been pushed to the remote repository by looking at the text next to the 01a-cross-references.qmd file. It should display the commit message you entered in the previous step.

  5. Click on the Issues tab.

  6. Click on the green New issue button.

  7. In the Title field write: Completed module 6 assignments

  8. In the Leave a comment field, tag the course instructors @seawaR @massarin @larnsce and share:

    • A question about cross-references or data types, OR
    • If you completed the bonus assignment: what you learned from working with for-loops
  9. Scroll down the page and click the green Submit new issue button.

Congratulations! You have completed the module 6 assignments and are now ready for the next module.