[datatable-help] fread'ing logicals

Matthew Dowle mdowle at mdowle.plus.com
Fri Sep 13 20:19:01 CEST 2013


All,

I've implemented skipping columns using NULL in colClasses,   and 
logicals are now also read.  read.csv reads 
"T","F","TRUE","FALSE","True" and "False" as type logical,  so I've 
followed suit.   But I'm wondering about the single letters "T" and 
"F".  To illustrate, the following might be confusing :

 > fread("A,B,C\nD,E,F\n")
    A B     C
1: D E FALSE
 > fread("A,B,C\nD,E,F\nG,H,I\n")
    A B C
1: D E F
2: G H I
 >

Should fread treat "T" and "F" as logical?   Should it read a column of 
only 0's and 1's as logical, too? I think I'd prefer that as it's quite 
common.

I'm also thinking of increasing the number of rows used for type 
detection to the top 500, middle 500 and bottom 500,  since that's a 
very small extra cost to save the relatively much larger cost of mid 
read column bumps. As a parameter, with 500 by default.

Matthew




More information about the datatable-help mailing list