title: Convert factor to integer in a data frame
body: <p>I have the following code</p>
  
  <pre><code>anna.table&lt;-data.frame (anna1,anna2)
  write.table&lt;-(anna.table, file="anna.file.txt",sep='\t', quote=FALSE) 
  </code></pre>
  
  <p>my table in the end contains numbers such as the following</p>
  
  <pre><code>chr         start    end      score
  chr2      41237927  41238801    151
  chr1      36976262  36977889    226
  chr8      83023623  83025129    185
  </code></pre>
  
  <p>and so on......</p>
  
  <p>after that i am trying to to get only the values which fit some criteria such as score less than a specific value</p>
  
  <p>so i am doing the following</p>
  
  <pre><code>anna3&lt;-"data/anna/anna.file.txt"
  anna.total&lt;-read.table(anna3,header=TRUE)
  significant.anna&lt;-subset(anna.total,score &lt;=0.001)
  
  Error: In Ops.factor(score, 0.001) &lt;= not meaningful for factors
  </code></pre>
  
  <p>so i guess the problem is that my table has factors and not integers</p>
  
  <p>I guess that my anna.total$score is a factor and i must make it an integer</p>
  
  <p>If i read correctly the as.numeric might solve my problem</p>
  
  <p>i am reading about the as.numeric function but i cannot understand how i can use it</p>
  
  <p>Hence could you please give me some advices?</p>
  
  <p>thank you in advance</p>
  
  <p>best regards
  Anna</p>
  
  <p>PS : i tried the following</p>
  
  <pre><code>anna3&lt;-"data/anna/anna.file.txt"
  anna.total&lt;-read.table(anna3,header=TRUE)
  anna.total$score.new&lt;-as.numeric (as.character(anna.total$score))
  write.table(anna.total,file="peak.list.numeric.v3.txt",append = FALSE ,quote = FALSE,col.names =TRUE,row.names=FALSE, sep="\t")
  
  anna.peaks&lt;-subset(anna.total,fdr.new &lt;=0.001)
  Warning messages:
  1: In Ops.factor(score, 0.001) : &lt;= not meaningful for factors
  </code></pre>
  
  <p>again i have the same problem......</p>