title: subtracting values a in column in R based on values in another column
body: <p>I have data that looks like the following</p>
  
  <pre><code>#    View  date    value1 Value2 
  #     a  2012-10-01 21.01  2.00
  #     b  2012-10-01 22.04  3.03
  #     c  2012-10-01 22.65  7.61
  #     a  2012-11-01 23.11  8.46
  #     b  2012-11-01 35.21  9.00
  #     c  2012-11-01 35.21  9.00
  
  structure(list(View = c("a", "b", "c", "a", "b", "c"), date = c("2012-10-01", 
  "2012-10-01", "2012-10-01", "2012-11-01", "2012-11-01", "2012-11-01"
  ), value1 = c(21.01, 22.04, 22.65, 23.11, 35.21, 35.21), Value2 = c(2, 
  3.03, 7.61, 8.46, 9, 9)), .Names = c("View", "date", "value1", 
  "Value2"), row.names = c(NA, -6L), class = "data.frame")
  </code></pre>
  
  <p>I want to create a new View "D" which is the subtraction of "a" from "c" for any given date. i.e end up with a dataset that looks like this?</p>
  
  <pre><code>#    View  date    value1 Value2 
  #     a 2012-10-01 21.01  2.00
  #     b 2012-10-01 22.04  3.03
  #     c 2012-10-01 22.65  7.61
  #     D 2012-10-01  1.61  5.61
  #     a 2012-11-01 23.11  8.46
  #     b 2012-11-01 35.21  9.00
  #     c 2012-11-01 35.21  9.00
  #     D 2012-10-01 12.1   0.54
  </code></pre>
  
  <p>I know a bit about R but I have no idea how I can approach this. Any suggestions would be greatly appreciated.</p>