title: How can I convert tabular row data to column data in javascript
body: <p>so I need to convert an array that contains tabular row data into column data in a specific format so I can use it to display a chart with Recharts.</p>
  <p>My data is in the following format:</p>
  <pre><code>rows = [
      ['Year', '2010', '2011', '2012', '2013'], 
      ['wages','2000','2000','2050','2050'], 
      ['purchase cost', '4000', '4300', '4500', '5000']
  ]
  </code></pre>
  <p>I need the data to be formatted as follows:</p>
  <pre><code>columns = [
      {'Year' : '2010', 'wages' : '2000', 'purchase cost' : '4000'}, 
      {'Year' : '2011', 'wages' : '2000', 'purchase cost' : '4300'}, 
      {'Year' : '2012', 'wages' : '2050', 'purchase cost' : '4500'}, 
      {'Year' : '2013', 'wages' : '2050', 'purchase cost' : '5000'}
  ]
  </code></pre>
  <p>I've gotten close to getting the result I need but can't seem to get it to work, so I would appreciate any help with this!</p>