Completing and submitting practice exercises

1 Accesssing exercises on GitHub

1.1 Register for an account and join the student team

  • You must sign up for a GitHub user account and share your GitHub username with me before I can create an exercise repository for you.
  • You must have installed R and RStudio to complete exercises and have Git installed.
  • Soon after I get your username, you should expect an email asking you to accept an invitation to the “2026_Students” Team in the class GitHub organization.

Don’t forget to connect RStudio to GitHub before working on the class exercises! Review the instructions on how to connect RStudio and GitHub for more information.

2 Creating an exercise repository using GitHub classroom

2.2 Downloading (a.k.a “cloning”) your exercise repository

  • Clone the repository to your computer using GitHub Desktop or using the GitHub website. Review the GitHub documentation on cloning a repository with GitHub Desktop or the GitHub website for more detailed instructions.
  • Find and open folder where you downloaded the local copy of the exercise repository. By default, this folder should have the same name as the repository itself.
  • As long as you keep this folder on your computer, you should do not need to clone the repository again. If you delete your local files or switch computers, you need to repeat this step.

2.3 Updating (a.k.a “syncing”) your exercise repository

  • If you work on your assignment and commit changes using multiple computers, you should “sync” the changes to the GitHub repository with your local copy of the project to make sure you are using the most recent version. Read the GitHub documentation on Syncing your branch in GitHub Desktop for more detailed instructions.

3 Complete the week’s exercise

The process for completing an exercise should be similar from week to week. The exercise repository has a Quarto document with instructions, example code, code for you to modify, and places for you to add your own code and writing in response to the instructions.

Do not rename the Quarto document or make a duplicate copy of the file in the repository. Instead, you should modify the existing file but leave the instructions in place for your own reference.

TipWhat is a Quarto document?

A Quarto document is a format that lets you mix blocks (also known as “chunks”) of R code with sections of text formatted using Markdown formatting. This format is similar to an older format known as RMarkdown (.Rmd). Quarto comes installed with RStudio but it is a separate command line application that can turn a qmd document into a standalone website, a formatted PDF, a presentation, and more. This course website, for example, is built with Quarto.

You can see that a front matter section at the top of each document. This front matter (also known as YAML) controls the format, appearance, and content of the rendered document.

The Hello, Quarto tutorial is a great place to learn how to render Quarto documents, run code blocks interactively, and format text using the markdown syntax.

3.1 Running code and writing responses to the exercise prompts

  • Complete the exercise by filling in the blank spaces, fixing any “broken” code in the document, or adding new code in the code blocks that look like this:
1 + 1 # example code
[1] 2
  • Try executing the code in each block as you work through the practice exercise. The results from the code appear right below the block. If you get an error or a warning, try to use that information as a clue to figure out what you need to change.

  • When you are done with the exercise, there should be no more blank spaces like this one: ____. The bonus exercises are optional but otherwise any code block that started empty should now have code inside.

  • Some questions require short written responses which should be completed as Markdown formatted text above or below the related code block—not as a comment inside the code block!

  • If all of your code blocks run, you should be able to “render” the .qmd document into a new HTML document. When I review completed assignments, my first step is always to try to render the document.

  • When you done with the exercise, please change the front matter for the document from status: Available to status: Complete.

  • Remember, you don’t need to get everything right and it is OK if your document won’t render. Just try your best with each part of the exercise.

TipTips for completing exercises
  • Complete each exercise from top to bottom. Blocks of code at the end of the document may depend on blocks from the beginning or middle so don’t skip around.
  • If you get an error message, read it. If it doesn’t make sense, try search the text of the message to find more information. R for Data Science reminds readers that Google is your friend.
  • Use the documentation! Use ? with the name of a function to review parameter definitions or examples.

4 Committing your completed exercise to the repository

You may have saved your updated document to your computer but the last step is to save or “commit” those changes to the exercise repository.

“Committing” your changes and syncing the changes with the remote version of your repository on GitHub allows me to see your completed exercise and share feedback on your work.

Do not upload files through the GitHub website to submit a complete exercise.

4.1 Commit changes with GitHub Desktop

One easy way to commit changes is using GitHub Desktop. Review the GitHub documentation on Committing and reviewing changes to your project in GitHub Desktop for detailed instructions.

4.2 Commit changes with RStudio

The second way to commit changes is using the Git tab within RStudio. This is a convenient option since you don’t need to leave RStudio to commit your changes. Remember you must connect RStudio and GitHub then restart RStudio to see the Git tab in the application.

Here is the step-by-step process (adapted from Connect RStudio to Git and GitHub in Happy Git and GitHub for the useR):

  • Click the “Git” tab in upper right pane.
  • Check “Staged” box for exercise_01.qmd.
  • If you’re not already in the Git pop-up, click “Commit”.
  • Type a message in “Commit message”, such as “Commit from RStudio”.
  • Click “Commit”.
  • Finally, click the green “Push” button to send your local changes to GitHub.
NoteWhen should you commit your changes?

Don’t wait until you are 100% finished with the exercise to commit your changes. You should get in the habit of commit changes every time you work on the exercise.

Please make sure to change the “status” for the exercise from “Available” to “Complete” when your exercise is complete and ready for evaluation. I try to evaluate the last week’s exercises on the Tuesday before each class session.