title: Quicker way to read single column of CSV file
body: <p>I am trying to read a single column of a <code>CSV</code> file to <code>R</code> as quickly as possible. I am hoping to cut down on standard methods in terms of the time it takes to get the column into RAM by a factor of 10.</p>
  
  <p>What is my motivation? I have two files; one called <code>Main.csv</code> which is 300000 rows and 500 columns, and one called <code>Second.csv</code> which is 300000 rows and 5 columns. If I <code>system.time()</code> the command <code>read.csv("Second.csv")</code>, it will take 2.2 seconds. Now if I use either of the two methods below to read the first column of <code>Main.csv</code> (which is 20% the size of <code>Second.csv</code> since it is 1 column instead of 5), it will take over 40 seconds. <strong>This is the same amount of time as it takes to read the whole 600 Megabyte file</strong> -- clearly unacceptable.</p>
  
  <ul>
  <li><p>Method 1</p>
  
  <pre><code>colClasses &lt;- rep('NULL',500)
  
  colClasses[1] &lt;- NA
  system.time(
  read.csv("Main.csv",colClasses=colClasses)
  ) # 40+ seconds, unacceptable
  </code></pre></li>
  <li><p>Method 2</p>
  
  <pre><code> read.table(pipe("cut -f1 Main.csv")) #40+ seconds, unacceptable
  </code></pre></li>
  </ul>
  
  <p>How to reduce this time? I am hoping for an <code>R</code> solution.</p>