Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The short answer is you did it perfectly. You just are having some difficulty with reading and writing files. Going through your code:</p> <pre><code>data&lt;-read.table('Table.txt', header=TRUE,row.names=1,sep='\t') </code></pre> <p>The above line is reading in your data fine, but the <code>row.names=1</code> told it to use the first column as names for rows. So now your SampleIDs are row names instead of being their own column. If you type <code>data</code> or <code>head(data)</code> or <code>str(data)</code> immediately after running this line, this should be clear. Just omit that row.names argument and it will read properly.</p> <pre><code>data &lt;- data.frame(data) </code></pre> <p>You don't need this above line because <code>read.table()</code> produces a dataframe. You can see that with <code>str(data)</code> as well.</p> <pre><code>data &lt;- data[order(data$Cluster),] </code></pre> <p>The above line is perfect.</p> <pre><code>write.table(data, file = 'OrderedTable.txt', append = TRUE, quote=FALSE, sep = '\t', na ='NA', dec = '.', row.names = TRUE, col.names = FALSE) </code></pre> <p>Here you included the argument <code>col.names = FALSE</code> which is why your file doesn't have column names. You also don't need/want <code>append=TRUE</code>. If you look at <code>help(write.table)</code>, you see it is "only relevant if file is a character string". Here it seems to make the file write without ending the last line, which would likely cause any later <code>read.table()</code> to complain.</p> <p>The numbers 1-15 in your result look like row numbers. You don't explain how you look at the resulting file, so I cannot be sure. You likely read your file in a way that doesn't parse the row.names and is showing row numbers instead. If you make certain your SampleIDs column does not get assigned to be names of rows, you'll probably be fine.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload