title: Dynamically select column content based on other column from the same row
body: <p>I am using Spark 1.6.1. Lets say my data frame looks like:</p>
  
  <pre><code>+------------+-----+----+
  |categoryName|catA |catB|
  +------------+-----+----+
  |     catA   |0.25 |0.75|
  |     catB   |0.5  |0.5 |
  +------------+-----+----+
  </code></pre>
  
  <p>Where <code>categoryName</code> has String type, and <code>cat*</code> are Double. I would like to add column that will contain value from column which name is in the <code>categoryName</code> column:</p>
  
  <pre><code>+------------+-----+----+-------+
  |categoryName|catA |catB| score |
  +------------+-----+----+-------+
  |     catA   |0.25 |0.75| 0.25  | ('score' has value from column name 'catA')
  |     catB   |0.5  |0.7 |  0.7  | ('score' value from column name 'catB')
  +------------+-----+----+-------+
  </code></pre>
  
  <p>I need such extraction to some later calculations. Any ideas?</p>
  
  <p>Important: I don't know names of category columns. Solution needs to be dynamic.</p>