Assignments for Techne I
These instructions will walk you through the process for submitting Problem Sets and Exams for Techne I. We provide a checklist first, followed by all the messy details.
Checklist
Accept the GitHub Classroom invitation. This creates a repo for you, located in the
Techne-I-Fall-2023organization.Use RStudio to clone this repo to your computer.
Start an empty Quarto document for your answers. Name it correctly.
Make progress.
- Follow the Style Guide.
- As you work, perform at least 5 commits. Provide a short (but meaningful!) commit message each time.
- Make sure to add *Rproj to your .gitignore.
- Push regularly. You don’t want to lose (much) work if your computer explodes.
- Label your R code chunks.
- Set
echo: falsein theexcute:portion of in your YAML header. We do not want to see any of your R code in the main portion of the PDF. The only place R code appears is in the## Codesection at the end. - Add meaningful comments to your code.
- Include the names of colleagues with whom you collaborate for problem sets (no collaboration is allowed on exams) at the end of the qmd, but before the
## Codesection.
Include this as the last item in your qmd:
\newpage
## Code
```{r print-code, ref.label = knitr::all_labels(), echo = TRUE, eval = FALSE}
```
Make sure that you do a final push once your work is complete.
Submit to Gradescope via the Github option, selecting the correct repo, and choosing the “main” branch. (You can do this as you work, if you like. Only the last version submitted, before the deadline, counts for grading purposes.)
Upload final PDF to Gradescope. Note that this is a separate assignment from the one to which you submitted your Github repo. Make sure that there are no warnings, messages, or errors. The only things that should appear in your PDF are plots, tables, written answers, and a copy of all of your code at the end.
Details
1. Accept the GitHub classroom invite
You will receive an email invitation to GitHub Classroom. Click on the link and accept the invitation! Doing so creates a Github repo in the Techne-I-Fall-2023 organization.
Accepting the invitation will create the new repository. (You may need to refresh the initial page before you are re-directed to a page with the new link.) Your empty repository may look something like this:
2. Use RStudio to “Clone with HTTPS” this repo to your computer
This process is what connects files on your computer to a Github repo.
3. Start an empty Quarto document
Once your repo is cloned, you should make an empty Quarto document (qmd) file to store your solutions. You must follow the course naming convention in order for Gradescope to work: ps_1.qmd or exam_1.qmd with “1” replaced by the number of the assignment you are working on. All file names are in lowercase letters. Click File -> New File -> Quarto Document, enter the Title and Author values. We generally recommend using format: html until you have passed all the Gradescope tests. Once you do, switch to format: pdf. You can format: pdf the whole time, if you want, but format: html tends to render more quickly and easily.
(If your computer can not create PDF files, then you can just use `format: html`` and then transform the html to PDF by hand when you submit.)
The qmd file is a technical document for text and code. This is a record of your work which allows anyone to reproduce your results. It should be well-organized, thoroughly commented, nicely formatted and clean.
The PDF file is a presentation document, designed for non-technical readers. No R code (except for your entire replication code at the end, described below), messages, warnings, or errors should appear.
Students often have trouble turning off R messages / warnings / errors. These should not appear in your PDF. Sometimes you notice random things you did not type appearing in your PDF that look like the sort of messages that often appear in your RStudio Console. These are messages, warnings, and errors. The right way to deal with these issues is to find out their cause and then fix the underlying problem.
Students sometimes use “hacks” to make these messages/warnings/errors disappear. The most common hacks involve using code chunk options like message: FALSE, warning: FALSE or error: FALSE. Don’t do this, in general. A message / warning / error is worth understanding and then fixing. Don’t close your eyes (metaphorically) and pretend that the problem doesn’t exist.
There are some situations, however, in which, no matter what you try, you can’t fix the problem. In those few cases, you can use one of these hacks, but you must make a code comment directly below it, explaining the situation. The only exception is the “setup” chunk which, although not required, is a very common location in which to load necessary packages. In that chunk, no explanation is necessary, by convention, for including message: false among the code chunk options, in order to avoid the default messages which packages will often automatically print when you load them with library(). Wrapping the call to library within suppressPackageStartupMessages() will also suppress those, but the message: false code chunk option is the more common approach.
Keep in mind that there are two types of questions:
Object questions: These types of questions will require you to create a particular named object in R. For example, Question 1 will ask you to perform various tidyverse operations on a tibble and save the result in a named object. The directions for these questions end with a Final Answer section, which will reiterate the specifications that your answer should meet. These instructions are very specific because they tell you exactly what the Gradescope autograder will be checking. These questions are automatically graded on Gradescope - you can use the Gradescope autograder to check your answers to these questions as many times as you like. For this portion, you will upload a .zip file containing only your qmd to the “Programming Questions” Gradescope autograder.
Plot/Written questions: Other questions in this course will require you to create graphics, write a paragraph, or do something else which cannot be automatically graded. These questions are not automatically graded, and do not contain a Final Answer section. For these questions, you will upload your PDF file to the Gradescope “Plot” assignment where they will graded by hand. For plotting and table questions, we will sometimes show you an example plot and sometimes not. We will sometimes ask you to make a plot which looks exactly like our plot, or as close as you can make it. Other times, we will give you free rein.
This means you will have to submit every assignment twice! A .zip file for the programming portion, and your final PDF for the visual and written questions.
4. Make progress
Answer the questions and use GitHub as you go to add, commit, and push changes as you make them. Create a label’d code chunk for each new question – remember that naming a code chunk just means adding #| label: Question 1 below the {r} invocation.
5. Push submittable version to GitHub
Do not wait until your file is ready to submit to commit changes. You need to commit files at least five times while working on problem sets and exams. It is good practice to make gradual commits to your repository as you make progress. If you are smart, you will also push regularly, but we do not monitor pushes, just commits.
Eventually, you will be done! Once you’re ready to submit something, make sure you push the latest version to your GitHub repo. Do not forget to add your Rproj file to your .gitignore. You should not upload your Rproj file to GitHub.
6. Upload Github repo to Autograder
Go to Gradescope and “submit” your work. Select “Github” as your “Submission Method”.
You will need to select your repo and then choose the default “main” branch. (You may need to authorize Github the first time. You may also need to ask us for permission to access the class organization. We are here to help!)
The big advantage of Gradescope is that you can automatically check your problem set and exam solutions as you complete them. Gradescope will take a few seconds to run, and eventually you will see a page like this:
The two messages here (called “tests”) check (1) if the file structure is correct and (2) whether your answers are correct. Here, we successfully uploaded the file and answered Question 1, so we received full credit. If Question 1 were wrong in some way, you would see a helpful message here telling you what happened and pointing you in the right direction. For example, here Question 1 asks you to slice the first 5 rows in the trains dataset. If you had submitting an object that was too large, the question label would note that the object you submitted did not have the correct number of rows.
Most importantly, you can do this process as many times as you want! That means you are able to grade your problem sets and exams as you work on them. Gradescope will store your final submission as your final grade for the assignment, but you can submit to the Autograder as many times as you want with no penalty.
7. Upload final PDF (with code) to Gradescope
Submit your PDF so that we can grade any remaining issues not covered by the Autograder — plots, written answers, code style, and so on. At the end of your qmd file, you should include an empty code chunk with the following code in brackets: r print-code, ref.label = knitr::all_labels(), echo = TRUE, eval = FALSE, as described above. This code chunk will print out all of the code in your chunks above. In order for this to work, your chunks will have to be named. You can also include a \newpage command in your text to force your code output to print on a new page. See the example below. For Problem Sets, you should also include the names of colleagues that you worked with in your final PDF. We define “worked with” very broadly.
Once you have your PDF prepared, go to Gradescope and click on the “PDF” assignment. Then, Gradescope will prompt you to select the pages that each written question is on (this is another reason why \newpage can be helpful!). Follow the instructions and press Submit when you’re done!
Note that the programming assignment and the PDF assignment have nothing to do with one another. That is, we do not care if the code you submit for programming is different from the code which generated your PDF. We do not check this. We just use the automated score. And then we look at your PDF and grade that by hand. We also have access to your repo, but that is more for helping you debug problems. Only two things affect your grade: Gradescope’s total and the PDF you submit.
Advice: Always render to html at the start. It is quicker and less error prone. You do not need to submit PDF (or even html) for the programming exercises. Only the qmd file is used. Once you have scored your 10/10, you do not need to submit again, even if you make changes. Instead, just worry about the PDF. What matters for that are the plots, tables and written answers, as well as the code printed at the end.