title: read.csv does not read complete file
body: <p>I am struggling to read a large (22MB) datafile in R with <code>read.csv</code>. I know there are a bunch of similar questions but none of the ones I found seem to help me solve my problem (<a href="https://stackoverflow.com/questions/16242584/r-correct-use-of-read-csv">one</a>, <a href="https://stackoverflow.com/questions/15115911/convert-r-read-csv-to-a-readlines-batch">two</a>, <a href="https://stackoverflow.com/questions/7788040/error-when-reading-in-data">three</a>, 
  My file has 6 columns, all but one are integers, and 330,001 rows.
  I can open the file in excel. There are no empty cells anymore and every column except the first one (id) has <code>NA</code> values. </p>
  
  <p>When I use the following code:</p>
  
  <pre><code>mt &lt;- read.csv("C:/path/master.csv", header=T, sep=",", encoding="utf-8")
  </code></pre>
  
  <p>I get 79,024 rows
  Changing this to the following (see <a href="https://stackoverflow.com/questions/17414776/read-csv-warning-eof-within-quoted-string-prevents-complete-reading-of-file">here</a>)</p>
  
  <pre><code>mt &lt;- read.csv("C:/Users/slebex/Desktop/PhB Data/master.csv", header=T, sep=",", quote="", encoding="utf-8")
  </code></pre>
  
  <p>Increases the rowcount to 104,510 but reads all my integers as factors (or characters when I add <code>stringsAsFactors = F</code>).</p>
  
  <p>Additionally, using the following code gives the below warning message and loads a large character of 26,234 elements only</p>
  
  <p><code>mt &lt;- readLines(file("C:/Users/slebex/Desktop/PhB Data/master.csv", encoding="utf-8"))</code></p>
  
  <pre><code>Warning messages:
  1: invalid input found on input connection 'C:/path/master.csv' 
  2: In readLines(file("C:/path/master.csv",  :
    incomplete final line found on 'C:/path/master.csv'
  </code></pre>
  
  <p>The datatable looks like this
  <code>head(mt)</code></p>
  
  <pre><code>  id App_date Grant_date Prior_date Num_inventors Assignee
  1  1       NA   18370630         NA             1     &lt;NA&gt;
  2  2       NA   18371028         NA             1     &lt;NA&gt;
  3  3       NA   18371028         NA             1     &lt;NA&gt;
  4  4       NA   18380109         NA             1     &lt;NA&gt;
  5  5       NA   18380203         NA             1     &lt;NA&gt;
  6  6       NA   18380210         NA             1     &lt;NA&gt;
  </code></pre>
  
  <p><code>tail(mt)</code></p>
  
  <pre><code>         id App_date Grant_date Prior_date Num_inventors
  79019 79019 19990826   20010206   19990826             2
  79020 79020 19990127   20010206   19920501             2
  79021 79021 19980213   20010206   19951002             4
  79022 79022 19941108   20010206   19931108             4
  79023 79023 19941208   20010206   19901025             1
  79024 79024 19980918   20010206   19931214             1
                                                                                                                                   Assignee
  79019                                                                                                          Novo Nordisk Biotech, Inc.
  79020                                                                                          Trustees Of The University Of Pennsylvania
  79021 Mohammad W. Katoot, Katoot, Administrator Karen Robbyn Goodan, Katoot, Administrator Ali Maroof, Katoot, Administrator Ahmed Maroof
  79022                                                                                                                   Mcgill University
  79023                                                                         The Trustees Of Columbia University In The City Of New York
  79024                                                                                                         Centr Embrionalnikh Tkaney 
  </code></pre>
  
  <p>As you can see, the <code>Assignee</code> variable contains various forms of punctuation. Perhaps this causes a problem I'm not sure (see <a href="https://stackoverflow.com/questions/24629442/r-trouble-reading-my-files-with-read-csv">comments here</a>). I removed all double spaces, changed all commas into semicolons, and removed all quotation marks, but that has not helped. </p>
  
  <p>Following <a href="https://stackoverflow.com/questions/29617582/read-csv-warning-unable-to-read-a-csv-file-in-r">this question</a> i did the following</p>
  
  <pre><code>library(readr)
  mt &lt;- read_csv("C:/Users/slebex/Desktop/PhB Data/master.csv")
  </code></pre>
  
  <p>This gives me the following error</p>
  
  <pre><code>Warning message:
  660101 problems parsing 'C:/Users/slebex/Desktop/PhB Data/master.csv'. See problems(...) for more details.
  </code></pre>
  
  <p>Despite the error the dataset gets fully loaded but two of my columns suddenly consist entirely of <code>NA</code> values.</p>
  
  <p>If relevant find below the sessionInfo()</p>
  
  <pre><code>R version 3.2.0 (2015-04-16)
  Platform: x86_64-w64-mingw32/x64 (64-bit)
  Running under: Windows 7 x64 (build 7601) Service Pack 1
  
  locale:
  [1] LC_COLLATE=English_Singapore.1252  LC_CTYPE=English_Singapore.1252   
  [3] LC_MONETARY=English_Singapore.1252 LC_NUMERIC=C                      
  [5] LC_TIME=English_Singapore.1252    
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  loaded via a namespace (and not attached):
  [1] tools_3.2.0
  </code></pre>
  
  <p>Any suggestions would be welcomed</p>