title: Calculate probability from a table
body: <p>I have a data frame as following:</p>
  
  <pre><code>current state   action  next state
  w                 1      w
  w                 1      w
  w                 1      o
  w                 1      o
  o                 1      w
  </code></pre>
  
  <p>I want to create a matrix to show that how much is probability of been in next state by taking action1. 
  The martix  that I want to have is as following:</p>
  
  <pre><code>          next.state
  current    o    w  Sum
     w       0.5 0.5  1.00
     o       0   1.00 1.00
  </code></pre>