title: Convert data.table to data.frame (i.e. undo setDT)
body: <p>I have a 20x2 dataframe. I converted that dataframe to a data.table to perform some operations (deleted the explanation of the operations and goal as out of scope). The conversion allowed me to avoid using a for loop. But the conversion generates some issues down the line. </p>
  
  <p>I need to convert the df data.table back into a data.frame. How can I do that? </p>
  
  <p>Thanks very much for your help.</p>
  
  <pre><code>df &lt;- data.frame(LastPrice = c( 1221, 1220, 1220, 1217, 1216,  1218 , 1216, 1216, 1217, 1220, 1219, 1218, 1220, 1216, 1217, 1218, 1218, 1207, 1206, 1205), KCT = c( 1218, 1218, 1219, 1218, 1221,  1217 , 1217, 1216, 1219, 1216, 1217, 1216, 1219, 1217, 1218, 1217, 1217, 1217, 1219, 1217))
  
  library(data.table)
  setDT(df)
  df[, check := as.integer(LastPrice &gt; KCT)]
  df[, Signal := do.call(pmin, shift(check, 0:2, type="lead"))]
  </code></pre>