title: Can I speed up calculations between R and Sqlite by using data.tables?
body: <p>I have a sqlite database of about 1.4 million rows and 16 columns. </p>
  
  <p>I have to run an operation on 80,000 id's : </p>
  
  <ol>
  <li>Get all rows associated with that id </li>
  <li>convert to R date object and sort by date</li>
  <li>calculate difference between 2 most recent dates</li>
  </ol>
  
  <p>For each id I have been querying sqlite from R using dbSendQuery and dbFetch for step 1, while steps 2 and 3 are done in R. Is there a faster way? Would it be faster or slower to load the entire sqlite table into a data.table ?  </p>