title: Ordering a Dataframe
body: <p>So I have the dataframe as follows:</p>
  
  <pre><code>              gene sample       value     score
  1    2310043M15Rik  1a_S1 0.035023917 0.8192723
  2    2310043M15Rik  2a_S2 0.030513262 0.8192723
  3    2310043M15Rik  3a_S3 0.043984305 0.8192723
  4    2310043M15Rik  1b_S1 0.000000000 0.8192723
  5    2310043M15Rik  2b_S2 0.000000000 0.8192723
  6    2310043M15Rik  3b_S3 0.000000000 0.8192723
  7    2310043M15Rik   4_S4 0.541528427 0.8192723
  8    2310043M15Rik   5_S5 0.601787500 0.8192723
  9    2310043M15Rik   6_S6 0.672417814 0.8192723
  10   2310043M15Rik 10_S10 1.791885603 0.8192723
  11   2310043M15Rik 11_S11 2.001114749 0.8192723
  12   2310043M15Rik 12_S12 1.700699778 0.8192723
  13   2310043M15Rik 16_S16 3.279904599 0.8192723
  14   2310043M15Rik 17_S17 3.389471358 0.8192723
  15   2310043M15Rik 18_S18 3.417522968 0.8192723
  16   2310043M15Rik 22_S22 2.578413695 0.8192723
  17   2310043M15Rik 23_S23 1.977315641 0.8192723
  18   2310043M15Rik 24_S24 1.951025717 0.8192723
  19   2310043M15Rik 28_S28 3.344688860 0.8192723
  20   2310043M15Rik 29_S29 2.768640841 0.8192723
  21   2310043M15Rik 30_S30 2.737122410 0.8192723
  22   2310043M15Rik 34_S34 3.851056653 0.8192723
  23   2310043M15Rik 35_S35 3.532010607 0.8192723
  24   2310043M15Rik 36_S36 3.590795543 0.8192723
  25   5730508B09Rik  1a_S1 1.146767967 0.8029265
  26   5730508B09Rik  2a_S2 0.678569811 0.8029265
  27   5730508B09Rik  3a_S3 0.756856431 0.8029265
  28   5730508B09Rik  1b_S1 1.131529434 0.8029265
  29   5730508B09Rik  2b_S2 0.824058995 0.8029265
  30   5730508B09Rik  3b_S3 0.780254355 0.8029265
  31   5730508B09Rik   4_S4 1.014725971 0.8029265
  32   5730508B09Rik   5_S5 1.152045200 0.8029265
  33   5730508B09Rik   6_S6 0.969898879 0.8029265
  </code></pre>
  
  <p>I am looking to order the dataframe by the score of each gene. I have tried the following:</p>
  
  <pre><code>c1m.tcps_up$gene &lt;- factor(c1m.tcps_up$gene, 
                         levels = c1m.tcps_up$gene [order(c1m.tcps_up$score)])
  </code></pre>
  
  <p>Where <code>c1m.tcps_up$gene</code> is the data frame, but the error keeps returning as follows:</p>
  
  <pre><code>Error in `levels&lt;-`(`*tmp*`, value = if (nl == nL) as.character(labels) else paste0(labels,  : 
  </code></pre>
  
  <p>factor level [2] is duplicated</p>
  
  <p>I'm still quite new to R and am trying to figure out exactly what is going on here, and where I am going wrong. </p>
  
  <p>Thanks!</p>