title: Read columns of a csv file using shell or pipe inside R - Windows
body: <p>I'm looking for a way of reading only a few columns from a csv file into R using shell() or pipe.</p>
  <p>I found this thread that explains how to accomplish that on Linux: <a href="https://stackoverflow.com/questions/19743271/quicker-way-to-read-single-column-of-csv-file/19744189#19744189">Quicker way to read single column of CSV file</a></p>
  <p>On Linux this works adding the <strong>what</strong> argument:</p>
  <pre><code>a &lt;-as.data.frame(scan(pipe(&quot;cut -f1,2 -d, Main.csv&quot;),
                         what=list(&quot;character&quot;,&quot;character&quot;),sep= &quot;,&quot;))
  </code></pre>
  <p>However this doesn't seem to work on Windows.</p>
  <p>When using <code>pipe(&quot;cut -f1 -d, Main.csv&quot;)</code> the connection gets opened but it doesn't return anything.</p>
  <p>What would be the functions/syntax I need to use in order to make this work on Windows.</p>
  <p>Is is possible to accomplish this by using shell()?</p>
  <p>Thanks,</p>
  <p>Diego</p>