title: How to skip invalid rows when reading data frame from file in R?
body: <p>I have a large file which contains lots of data, and I'd like to read it into dataframe, but found some invalid rows. These invalid rows cause the read.table to break. I try the following method to skip invalid lines, but it seems the performance is very bad.</p>
  
  <pre><code>counts&lt;-count.fields(textConnection(lines),sep="\001")
  raw_data&lt;-read.table(textConnection(lines[counts == 34]), sep="\001")
  </code></pre>
  
  <p>Is there any better way to achieve this? Thanks </p>