title: How can I count the average from Spark RDD?
body: <p>I have a problem with Spark Scala which I want count the average from the Rdd data,I create a new RDD like this,</p>
  
  <pre><code>[(2,110),(2,130),(2,120),(3,200),(3,206),(3,206),(4,150),(4,160),(4,170)]
  </code></pre>
  
  <p>I want to count them like this,</p>
  
  <pre><code>[(2,(110+130+120)/3),(3,(200+206+206)/3),(4,(150+160+170)/3)]
  </code></pre>
  
  <p>then,get the result like this,</p>
  
  <pre><code>   [(2,120),(3,204),(4,160)]
  </code></pre>
  
  <p>How can I do this with scala from RDD? 
  I use spark version 1.6</p>