Skip to content

About Assignments

pmagwene edited this page Sep 16, 2011 · 6 revisions

Most of the homework assignments require you to write code or carry out a set of calculation using R or Python. Your code and calculations should be prepared as literate programming documents to be processed by Sweave or Pweave.

Due dates

Unless otherwise stated, assignments are due before the start of the next class session. Late submissions will receive zero credit.

Guidelines

When submitting your homework please follow these guidelines:

  • Use a meaningful subject line in your email when you submit the homework, e.g. Bio 313, Hands On 2 assignments rather than re: Question about Python Code.
  • In general, you should submit only two files each week -- a single Sweave file with all the R assignments and single Pweave files with any Python assignments. I do not need the generated LaTeX or PDF files -- I'll generate those on my end. Also, do not submit any standard data sets that I provide for the assignment or that are packaged as part of R.
  • Name your files with the following convention: <lastname>-<firstinitial>-<handsonweek>-sweave.Rnw for Sweave documents and *-pweave.Pnw for Pweave documents. For example, for the assignments corresponding to Hands-on 2, my Sweave file would be: magwene-p-2-sweave.Rnw
  • If the assignment requires accessory functions, embed those functions in the Sweave/Pweave document.
  • Except where explicitly required to do so, avoid calls that will print out long tables and data sets. For example, I don't need to see the entire iris data set printed out in every R assignments that uses it.
  • Test your Sweave/Pweave documents in a fresh directory (see below) before turning in your assignments

Testing your Sweave/Pweave code

When I receive your assignment I will:

  1. process your documents using Sweave/Pweave
  2. Create PDF reports of successfully processed documents using pdflatex
  3. Check your code and calculations for correctness

If I'm unable to carry out steps 1 and 2 with the code you submit, I will return the document and ask you to fix any errors before I proceed to step 3. To minimize the instances in which the Sweave/Pweave document seems to compile fine on your computer, but not on mine please take the following steps to test your code before submitting any homeworks:

  1. Create an empty directory (e.g. ~/test)
  2. Copy your Sweave/Pweave file to that directory
  3. Copy any data sets that your code needs to that directory
  4. For R:
  • start a fresh R session and make sure your workspace is cleared by issuing this command: remove(list = ls(all = TRUE))
  • Sweave your document
  • If it compiles fine and you're able to create a PDF with the correct output then it highly likely it will work fine on my machine
  1. For Python, test:
  • Navigate to the directory
  • From the command prompt, confirm you can process the files with the command: Pweave -ftex filename (or Pweave.py -ftex filename on Windows)
  • Check the PDF for correctness as above

Clone this wiki locally