title: Read numbers from CSV file in R with NaN present in data file
body: <p>I have a CSV file, with some char fiels and numeric fields and some NaN's located in the file. I want to read the numeric fields as numeric and character fields as characters. </p>
  
  <p>For example my CSV file <code>monthly.csv</code> is presently like this</p>
  
  <pre><code>Datum,Index,D12,E12,b/m,tbl,AAA
  187101,4.44,0.2600,0.4000,NaN,NaN,NaN
  187102,4.50,0.2600,0.4000,NaN,NaN,NaN
  ...
  ...
  ...
  </code></pre>
  
  <p>I am reading this with the following code</p>
  
  <pre><code>monthly &lt;- read.csv2("monthly.csv", sep=',', header = T, na.strings = "NaN", stringsAsFactors=F)
  </code></pre>
  
  <p>After reading when I view the contents of <code>monthly</code> variable, I still see the type as </p>
  
  <pre><code>&gt; str(monthly)
  'data.frame':   1620 obs. of  7 variables:
   $ Datum     : int  187101 187102 187103 187104 187105 187106 187107 187108 187109 187110 ...
   $ Index     : chr  "4.44" "4.50" "4.61" "4.74" ...
   $ D12       : chr  "0.2600" "0.2600" "0.2600" "0.2600" ...
   $ E12       : chr  "0.4000" "0.4000" "0.4000" "0.4000" ...
   $ b.m       : chr  NA NA NA NA ...
   $ tbl       : chr  NA NA NA NA ...
   $ AAA       : chr  NA NA NA NA ...
  </code></pre>
  
  <p>Basically only the first field is getting converted to an <code>int</code> and the rest all are still <code>chr</code> . How do make the others too as <code>int</code></p>