title: How to transpose the table by keeping the header names
body: <p>I simplified my previous question. Apologies for the inconvenience. 
  How to transpose the table by keeping the header names. I can not achieve this by using <code>t()</code> either. </p>
  
  <pre><code>q &lt;- tribble(
    ~name, ~g1, ~g2, ~g3,
    "t1", 0,  1,  2,
    "t1", 2,  2,  2,
    "t2", 1,  2,  3,
    "t2", 3,  3,  3,
    "t4", 4,  4,  4
  )
  
  
  q %&gt;%
    rownames_to_column %&gt;% 
    gather(row, value, -rowname) %&gt;% 
    spread(rowname, value) 
  </code></pre>
  
  <p>Desired output</p>
  
  <pre><code>name    t1    t1    t2    t2    t4
  g1     0     2     1     3     4
  g2     1     2     2     3     4
  g3     2     2     3     3     4
  </code></pre>