title: How do you convert 2 columns into 2 rows in R?
body: <p>I have a 2 column dataframe that I want to become 2 rows instead. The dimensions are 40 observations and 2 variables (whereas what I want is 40 variables and 1 observation, as I want the first row to become the column headers).</p>
  
  <p>I have tried using reshape but I can't seem to get it right as I keep getting errors. Here is the dataframe that I am using:</p>
  
  <pre><code>      Data.Label                      Test2
  1     Family                          Petromyzontidae - lampreys
  2     Species                         Ichthyomyzon castaneus
  3     Taxonomic Authority             Girard, 1858
  4     Common Name(s)                  Chestnut Lamprey
  5     French Name                     lamproie brune
  6     OMNR Code                       016
  </code></pre>
  
  <pre><code>Test5 &lt;- reshape(Test4, timevar = Test4$Data.Label, idvar = Test4$Test2,direction = "wide")
  Error in `[.data.frame`(data, , idvar) : undefined columns selected
  </code></pre>
  
  <p>As mentioned, I've tried to use reshape. As there are 40 variables that I would like to become the column headers (Test4$Data.Label) I did not want to write out each one for the idvars. Is there another way to do this? </p>
  
  <p>The desired result would be:</p>
  
  <pre><code>Family                     Species                Taxonomic Authority                Common Name(s)                French Name                OMNR Code                      
  Petromyzontidae lampreys   Ichthyomyzon castaneus  Girard, 1858                      Chestnut Lamprey             lamproie brune              016
  
  </code></pre>
  
  <p>This way the Test4$Data.Label column becomes the column headers (40 in total) and the Test4$Test2 column becomes the 1st row.</p>