title: How to read tab separated file into data.table using fread?
body: <p>Sample data (<code>emp.data</code>)</p>
  
  <pre><code>Beth  4.00  0
  Dan   3.75  0
  Kathy 4.00  10
  Mark  5.00  20
  Mary  5.50  22
  Susie 4.25  18
  </code></pre>
  
  <p>I can read it into a <code>data.frame</code> using <code>read.table</code>, then convert it to <code>data.table</code>:</p>
  
  <pre><code>library(data.table)
  df &lt;- read.table("emp.data", col.names = c("Name", "PayRate", "HoursWorked"))
  DT &lt;- as.data.table(df, key = HoursWorked)
  </code></pre>
  
  <p>Calculate the pay (filter out zero hours):</p>
  
  <pre><code>DT[HoursWorked &gt; 0, .(Name, Pay = PayRate * HoursWorked),]
  
      Name   Pay
  1: Kathy  40.0
  2:  Mark 100.0
  3:  Mary 121.0
  4: Susie  76.5
  </code></pre>
  
  <p>That works fine; however, I consider there's an extra step in converting. Since there's <code>fread()</code> in <code>data.table</code>, why not use it directly?</p>
  
  <pre><code>readDT &lt;- fread("emp.data", header=FALSE, sep="\t")
  
                 V1
  1:  Beth  4.00  0
  2:  Dan   3.75  0
  3: Kathy 4.00  10
  4: Mark  5.00  20
  5: Mary  5.50  22
  6: Susie 4.25  18
  
   str(readDT)
  Classes 'data.table' and 'data.frame':  6 obs. of  1 variable:
   $ V1: chr  "Beth  4.00  0" "Dan   3.75  0" "Kathy 4.00  10" "Mark  5.00  20" ...
   - attr(*, ".internal.selfref")=&lt;externalptr&gt; 
  </code></pre>
  
  <p>The data is recognized as one column; obviously this doesn't work.</p>
  
  <p><strong>Question</strong></p>
  
  <p>How to read this data using <code>fread()</code> properly? (If possible, set the column names as well.)</p>