title: Using transpose with arrays in Ruby?
body: <p>I have the following:</p>
  
  <pre><code>table(
    [
      [
        "UnitID",
        "First Name",
        "Last Name",
        "NPS Score",
        "Comments",
        "emotion",
        "polarity"
      ],
      *[
        invite_unitid_arr,
        invite_name_arr,
        invite_lastname_arr,
        nps_score_integers,
        comment_arr,
        SadPanda.emotion(comment_arr),
        SadPanda.polarity(comment_arr)
      ].transpose
    ]
  )
  </code></pre>
  
  <p>However, <code>SadPanda.emotion(comment_arr)</code> and <code>SadPanda.polarity(comment_arr)</code> return:</p>
  
  <pre><code>undefined method 'gsub!' for #&lt;Array:0x007f8f9b0d40a8&gt;
  </code></pre>
  
  <p>How can I transpose the array but also use <code>SadPanda.emotion()</code> on each string value within the array?</p>
  
  <p>EDIT:</p>
  
  <p>To be clear, this is what I want as an end result:</p>
  
  <pre><code>[
  invite_unitid_arr[0],
  invite_name_arr[0],
  invite_lastname_arr[0],
  nps_score_integers[0],
  comment_arr[0],
  SadPanda.emotion(comment_arr[0]),
  SadPanda.polarity(comment_arr[0])
  ],
  
  [
  invite_unitid_arr[1],
  invite_name_arr[1],
  invite_lastname_arr[1],
  nps_score_integers[1],
  comment_arr[1],
  SadPanda.emotion(comment_arr[1]),
  SadPanda.polarity(comment_arr[1])
  ]
  </code></pre>
  
  <p>Etc. etc. The <code>.transpose</code> method does exactly what I need it to do for all values in the array, but I don't know how to pass in <code>comment_arr[0]</code> on the <code>.emotion</code> and <code>.polarity</code> methods and increment that value each time the array is transposed.</p>