1 + 1 # example code[1] 2
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.
Each exercise is distributed as an “assignment” using GitHub Classroom. When you open a link to an assignment, you are prompted to clone (or copy) the assignment to your GitHub account.
The copies of the exercise on the course website are provided as a general reference only. Do not create your own repository for an exercise without the GitHub classroom link or copy exercise files from the course website to a personal repository.
A repository is a collection of files where changes can be tracked and managed using a version control system. Git is a version control system. GitHub is a web service that makes it easier to manage version-controlled repositories and collaborate with others. Learn more about Git and GitHub in Ch. 1 Why Git? Why GitHub? from Happy Git and GitHub for the useR by Jenny Bryan.
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.
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.
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.
? with the name of a function to review parameter definitions or examples.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.
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.
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):
exercise_01.qmd.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.