title: Reading numbers as strings
body: <p>I am new at R programming and I want to read a text file in R.   </p>
  
  <p>One of the columns, lets say column 7 is numeric and each number represent an ID I want R to read the numbers as if they were strings. And count the number of times each ID appear in the file (such that later I can assign the frequency of each ID to the given ID for latter use) 
  I have tried</p>
  
  <pre><code>mydata&lt;-(read.table(filename.txt))
  ID=mydata[7]
  freq=table(ID)
  </code></pre>
  
  <p>This works but it takes the IDs as numbers. Now I have tried</p>
  
  <pre><code>freq=table(as.character(ID))
  </code></pre>
  
  <p>But then it takes the whole column ID as only one string and from </p>
  
  <pre><code>summary(freq)
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>Number of cases in table: 1 
  Number of factors: 1 
  </code></pre>