text: user13885: I am trying to run DESeq2 analysis on my featureCounts output counts table.
  I ran the following code:
  library("DESeq2")
  
  samplefile<-"C:/Users/RGB King/Documents/R/~/R/DESeq2_analysis/sample_table.txt"
  
  coldata<-read.table(file=samplefile, sep="\t", header=FALSE, col.names = as.factor(c("","treatment")), row.names=1)
  
  countfile<-"C:/Users/RGB King/Documents/R/~/R/DESeq2_analysis/feature_counts_test_AvABC.txt"
  countdata<-read.table(file=countfile, sep="\t", header=FALSE, row.names = 1)
  
  countdata<-countdata[-c(1:5)]
  
  dds <- DESeqDataSetFromMatrix(
      countData = countdata,
      colData = coldata,
      design = ~ treatment
  )
  
  I then get the following error:
  Warning message:
  
  In DESeqDataSet(se, design = design, ignoreRank) :
  
    some variables in design formula are characters, converting to factors
  
  The countdata table looks as follows:
  |------|Variable1|Variable2|Variable3|Variable4|Variable5|Variable6|Variable7|Variable8|
  |GeneID|A_1.bam--|A_2.bam--|A_3.bam--|A_4.bam--|AB_1.bam-|AB_2.bam-|AB_3.bam-|AB_4.bam-|
  |THI3--|:12:-----|:34:-----|:8:------|:15:-----|:6:------|:22:-----|:41:-----|:33:-----|
  |THI7--|:17:-----|:78:-----|:9:------|:23:-----|:11:-----|:54:-----|:19:-----|:7:------|
  
  The coldata looks like this:
  |--------|treatment|
  |A_1.bam-|:A:------|
  |A_2.bam-|:A:------|
  |A_3.bam-|:A:------|
  |A_4.bam-|:A:------|
  |AB_1.bam|:B:------|
  |AB_2.bam|:B:------|
  |AB_3.bam|:B:------|
  |AB_4.bam|:B:------|
  
  
  So after I got the error I found posts on a forum that stated that DESeq2 only recognises "integer" class input values for the analyses. Therefore, I ran the following code:
  sapply(countdata,class)
  
  This then showed me that the data in the countdata table was in "character" class, so to fix this I ran the following:
  chars <- sapply(countdata, is.character)
  countdata[ , chars] <- as.data.frame(apply(countdata[ , chars], 2, as.integer))
  
  But this then caused the values in the GeneID row to become "NA". So my questions are how can I change the class of just the GeneID row back to what it was? Will this then allow the analysis to run correctly? And in my code for the countdata I do specify "row.names =1" so why does this not keep my values in the GeneID row separate from the rest of the table?
  
  user-1: There is nothing wrong with your colData. It is encoded as character rather than factor, and DESeq2 is turning it into factors, that is all that the warning (warning != error) tells. I never needed to convert my matrix to load featureCounts output into DESeq2. Just load the output with the header, use rownames() to move the gene column to rownames, remove all the non-relevant columns (that is usually 1-7) and then feed the remaining one into DESeq2. I have no featureCounts output at hand right now. If you need code then please provide suitable example data via the dput function for easy copy/pasting.
  
  user15931: As the warning message is suggesting, you should convert the class of your treatment column in coldata from character to factor.
  Use this:
  coldata$treatment = factor(coldata$treatment)
  
original_text: 13885: <p>I am trying to run DESeq2 analysis on my featureCounts output counts table.</p>
  <p>I ran the following code:</p>
  <pre><code>library(&quot;DESeq2&quot;)
  
  samplefile&lt;-&quot;C:/Users/RGB King/Documents/R/~/R/DESeq2_analysis/sample_table.txt&quot;
  
  coldata&lt;-read.table(file=samplefile, sep=&quot;\t&quot;, header=FALSE, col.names = as.factor(c(&quot;&quot;,&quot;treatment&quot;)), row.names=1)
  
  countfile&lt;-&quot;C:/Users/RGB King/Documents/R/~/R/DESeq2_analysis/feature_counts_test_AvABC.txt&quot;
  countdata&lt;-read.table(file=countfile, sep=&quot;\t&quot;, header=FALSE, row.names = 1)
  
  countdata&lt;-countdata[-c(1:5)]
  
  dds &lt;- DESeqDataSetFromMatrix(
      countData = countdata,
      colData = coldata,
      design = ~ treatment
  )
  </code></pre>
  <p>I then get the following error:</p>
  <pre><code>Warning message:
  
  In DESeqDataSet(se, design = design, ignoreRank) :
  
    some variables in design formula are characters, converting to factors
  </code></pre>
  <p>The countdata table looks as follows:</p>
  <pre><code>|------|Variable1|Variable2|Variable3|Variable4|Variable5|Variable6|Variable7|Variable8|
  |GeneID|A_1.bam--|A_2.bam--|A_3.bam--|A_4.bam--|AB_1.bam-|AB_2.bam-|AB_3.bam-|AB_4.bam-|
  |THI3--|:12:-----|:34:-----|:8:------|:15:-----|:6:------|:22:-----|:41:-----|:33:-----|
  |THI7--|:17:-----|:78:-----|:9:------|:23:-----|:11:-----|:54:-----|:19:-----|:7:------|
  </code></pre>
  <p>The coldata looks like this:</p>
  <pre><code>|--------|treatment|
  |A_1.bam-|:A:------|
  |A_2.bam-|:A:------|
  |A_3.bam-|:A:------|
  |A_4.bam-|:A:------|
  |AB_1.bam|:B:------|
  |AB_2.bam|:B:------|
  |AB_3.bam|:B:------|
  |AB_4.bam|:B:------|
  
  </code></pre>
  <p>So after I got the error I found posts on a forum that stated that DESeq2 only recognises &quot;integer&quot; class input values for the analyses. Therefore, I ran the following code:</p>
  <pre><code>sapply(countdata,class)
  </code></pre>
  <p>This then showed me that the data in the countdata table was in &quot;character&quot; class, so to fix this I ran the following:</p>
  <pre><code>chars &lt;- sapply(countdata, is.character)
  countdata[ , chars] &lt;- as.data.frame(apply(countdata[ , chars], 2, as.integer))
  </code></pre>
  <p>But this then caused the values in the GeneID row to become &quot;NA&quot;. So my questions are how can I change the class of just the GeneID row back to what it was? Will this then allow the analysis to run correctly? And in my code for the countdata I do specify &quot;row.names =1&quot; so why does this not keep my values in the GeneID row separate from the rest of the table?</p>
   -1: <p>There is nothing wrong with your colData. It is encoded as character rather than factor, and DESeq2 is turning it into factors, that is all that the warning (warning != error) tells. I never needed to convert my matrix to load featureCounts output into DESeq2. Just load the output with the header, use <code>rownames()</code> to move the gene column to rownames, remove all the non-relevant columns (that is usually 1-7) and then feed the remaining one into DESeq2. I have no featureCounts output at hand right now. If you need code then please provide suitable example data via the <code>dput</code> function for easy copy/pasting.</p>
   15931: <p>As the warning message is suggesting, you should convert the <code>class</code> of your <code>treatment</code> column in <code>coldata</code> from <code>character</code> to <code>factor</code>.</p>
  <p>Use this:<br />
  <code>coldata$treatment = factor(coldata$treatment)</code></p>
  