title: How to calculate a vector of midpoints or medians from a vector of cut points?
body: <p>Suppose I have a vector of cut points, for the purposes of this question, generated as follows:</p>
  
  <pre><code>&gt; seq(0,50,10)
  [1]  0 10 20 30 40 50
  </code></pre>
  
  <p>This is a numeric vector of length 6. I would like to generate a numeric vector of midpoints, to get either of the following (both of which meet my requirements), of length one less of the cuts (in this case, 5).</p>
  
  <pre><code># midpoints, exactly
  5 15 25 35 45
  # medians excluding right
  4.5 14.5 24.5 34.5 44.5
  </code></pre>
  
  <p>Not finding a pre-rolled function, I developed a procedure that takes a numeric vector as an argument (the cut points) and returns a vector (the midpoints). It works by taking the median of index 1 and index 2 and appending it to a vector, then the median of index 2 and index 3, and so on until the last index is NULL.</p>
  
  <p>Surely, I can't be the first one to have this need. Is there a package with such a procedure? I don't mind rolling by own, but honestly I'd rather use a package that's been subject to the rigors of public scrutiny.</p>
  
  <p>Thanks</p>