title: Manual calculation of the Kaplan-Meier estimator
body: <p>I thought this would be a trivial thing to do but I still have some trouble adjusting to writing code instead of pointing and clicking on a spreadsheet. </p>
  
  <pre><code>month = as.integer(c(1,2,3,4,5,6,7,8,9,10,11,12))
  remaining = c(1000,925,852,790,711,658,601,567,530,501,485,466)
  left = c(75, 73, 62, 79, 53, 57, 34, 37, 29, 16, 19, 0)
  KPdata = data.frame(month, remaining, left)
  
  &gt; KPdata
     month remaining left    
  1      1      1000   75 
  2      2       925   73 
  3      3       852   62 
  4      4       790   79 
  5      5       711   53 
  6      6       658   57 
  7      7       601   34
  8      8       567   37 
  9      9       530   29 
  10    10       501   16 
  11    11       485   19 
  12    12       466   12 
  </code></pre>
  
  <p>How do I calculate the Kaplan-Meier survival function at each month? Note that I want to do this manually, I am aware that there are packages which will do it for me. </p>