Due in class, 30 Sep.
Read coping with hitchhikers and couch potatoes on teams, and write a half-page essay on how you feel the paper relates to your past or present experiences.
calculate_prize function that solves the problem. Go back to the three cases we broke the problem into and consider if they still make sense. If they do, modify the code inside each of those cases, otherwise completely rewrite the function.As well as handling in a printed copy of your code (so I can write comments on it), you will also need to email me an electronic version. Your electronic submission should be named lastname-firstname.r (so mine would be wickham-hadley.r), it should run without errors if you run source("lastname-firstname.r"), and it should contain a single function called calculate_prize. Do not load the data or change the working directory (I'll be grading this code automatically).
Use the following code to check that your function works correctly (we'll be learning about this in a couple of weeks).
slots <- read.csv("slots.csv", stringsAsFactors = FALSE)
# A simple approximate to the prize function
calculate_prize <- function(windows) 0
# or alternatively: source("wickham-hadley.r")
library(plyr)
slots$check <- unlist(alply(as.matrix(slots[c("w1", "w2", "w3")]), 1, calculate_prize))
subset(slots, check != prize)
Do 10 function drills.
Ten points according to the code rubric (rubric score divided by three).
Five points for correctness: 5 if all prizes correct, 4 if single mistake, 3 if two or more mistakes, 2 if multiple mistakes, 1 if mostly mistakes. Additionally, you'll lose points if I need to modify your code to get it run (if you code works with the sample above, you'll be fine).
Five points for your comments on the reading: 5 points for a reflective and thoughtful response, 4 for good, 3 for ok.
One point each for each function drill.