title: R construct a data frame using 2 column
body: <p>I have a data frame like:</p>
  <p>df</p>
  <pre><code>    group group_name      value
  1       1       &lt;NA&gt;     VV0001
  2       1       &lt;NA&gt; VV_RS00280
  3       2       &lt;NA&gt;     VV0002
  4       2       &lt;NA&gt; VV_RS00285
  5       3       &lt;NA&gt;     VV0003
  6       3       &lt;NA&gt; VV_RS00290
  7       5       &lt;NA&gt;     VV0004
  8       5       &lt;NA&gt; VV_RS00295
  9       6       &lt;NA&gt;     VV0005
  10      6       &lt;NA&gt; VV_RS00300
  11      7       &lt;NA&gt;     VV0006
  12      7       &lt;NA&gt; VV_RS00305
  13      8       &lt;NA&gt;     VV0007
  14      8       &lt;NA&gt; VV_RS00310
  15      9       &lt;NA&gt;     VV0009
  16      9       &lt;NA&gt; VV_RS00315
  17     10       &lt;NA&gt;     VV0011
  18     10       &lt;NA&gt; VV_RS00320
  19     11       &lt;NA&gt;     VV0012
  20     11       &lt;NA&gt; VV_RS00325
  21     12       &lt;NA&gt;     VV0013
  22     12       &lt;NA&gt; VV_RS00330
  </code></pre>
  <p>so I want to construct an other data frame using the columns &quot;group&quot; and &quot;value&quot;, all the group 1 (<code>df[df$group == 1,]</code>) will get the data in &quot;value&quot; column (VV0001, VV_RS00280) and construct the data.frame like:</p>
  <pre><code>   group  value
  1  VV0001 VV_RS00280
  </code></pre>
  <p>and then the next <code>df[df$group == 2,]</code>, and so on, at the end will be:</p>
  <pre><code>   group  value
  1  VV0001 VV_RS00280
  2  VV0002 VV_RS00285
  3  VV0003 VV_RS00290
  4  VV0004 VV_RS00295
  </code></pre>
  <p>I tried to do it manually but the <code>nrow(df)</code> is big, &gt; 3000 or more !!</p>
  <p>Thanks</p>