title: Extract value from cell where one column/row value is equal to the column name
body: <p>I've seen several threads on solutions to this, but I am struggling implementing them. I have a df with columns across the top with descriptions, and then I have a list of samples with data that are grouped by description. I need to extract the values where the descriptions match the column names. </p>
  
  <p>I have tried different solutions using match, cbind, sapply...etc, but get errors about an invalid type(matrix) or having duplicate row names.</p>
  
  <pre><code> df1
   #row   description    sample    ball   square    circle
   1      ball           1a        .78      .04      .22
   2      ball           7b3       .32      .33      .33
   3      square         aaabc     .02      .90      .05
   4      circle         ggg3      .05      .04      .90
   5      circle         44        .01      .25      .70
  </code></pre>
  
  <p>My output would be:</p>
  
  <pre><code> df2
   #row   description    sample    value
   1      ball           1a        .78      
   2      ball           7b3       .32      
   3      square         aaabc     .90      
   4      circle         ggg3      .90
   5      circle         44        .70
  </code></pre>
  
  <p>And then taking that one step further, I would then filter it</p>
  
  <pre><code> df2 %&gt;%
   filter(value &lt; .9) %&gt;%
   select(description, sample, value)
  </code></pre>
  
  <p>Resulting in:</p>
  
  <pre><code> #row   description    sample    value
   1      ball           1a        .78      
   2      ball           7b3       .32      
   3      circle         44        .70
  </code></pre>
  
  <p>I know this is a duplicate, I'm just drawing a blank as to why I can't get the solutions to work with this data set.</p>