<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hi,</div><div><br></div><div>I am trying to get fread() to read NA without coercing the entire column to character, but I am unable to do it.  Please tell me whether I am doing something wrong or this is a bug.</div><div><br></div><div># Load two data tables with a column of integers -- one with NA and one without<br></div><div>dt1 <- fread( "a\n2\n4\n8\n5", na.strings=c("?") )<br>dt2 <- fread( "a\n2\n4\n?\n5", na.strings=c("?") )<br></div><div><br></div><div># The contents of both are as expected (or so it seems)</div><div>dt1</div><div>dt2</div><div><br></div><div># The class of the column with NA is character</div><div>class( dt1$a )</div><div>class( dt2$a )    # Not expecting this to be character</div><div><br></div><div># Even setting colClasses does not help<br></div><div>dt3 <- fread(
 "a\n2\n4\n?\n5", na.strings=c("?"), colClasses=c(a="integer") )</div><div>class( dt3$a )<br><br></div><div><br></div><div>Thanks for your help.</div><div><br></div><div>Regards,</div><div>Harish</div><div></div></div></body></html>