Creating a homework doc and its grading guide in one go

I write homework assignments for students. I also need to create a different version of the same document with all the answers and scoring guide for the tutors (teaching assistants). It is irritating to create two different versions of the document by hand. To avoid this, I’ve come up with the following imperfect solution:

  • Write the assignment in .Rmd. One side benefit of this is one can automate adding up the points that each question is worth.
  • Include all the information for grading the homework, such as the correct answers and partial credit answers, in markdown comments: , below each question.
  • Render the .Rmd to PDF with RStudio knitR and send it to the students.
  • Pass the .Rmd through a sequence of sed commands to replace the comment tags with tags for a code block, creating a “gradingGuide.Rmd”.
  • Render gradingGuide.Rmd to PDF or html, and send it to the tutors (teaching assistants).

Any other solutions out there?

2 thoughts on “Creating a homework doc and its grading guide in one go

  1. While trying to find the blog-post where I found the way I’m currently doing it (define a variable “showSolution” and use “`r include=showSolution“` or echo=showSolution etc., results=”asis” is very helpful here) I found this stackoverflow question:

    http://stackoverflow.com/questions/39550732/is-there-a-way-to-have-conditional-markdown-chunk-execution-in-rmarkdown

    The solution to the question is alot better than what I had (and what the person asking the question had)

    `r if(!params$showSolution) {“\\begin{comment}”}`
    # solution goes here
    `r if(!params$showSolution) {“\\end{comment}”}`

    Which I might use in the future.

    Hope that helps!
    Best, Benedikt

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s