[datatable-help] Is there any overhead to converting back and forth from a data.table to a data.frame?

Chris Neff caneff at gmail.com
Mon Apr 7 17:31:47 CEST 2014


I prefer data.tables for all the code processing I do.  But others on my
team using my functions aren't comfortable with data.tables, so most of the
libraries I write end with

 return(data.frame(DT))

Is there any copying or other overhead happening there? Since it inherits
from data.frame, I think the answer is no.

Now, if I have a function that does such a return, but I wrap that itself
in a data.table call:

data.table(func_that_returns_df())

Is there any inefficiency there?  Is there a difference between
data.table() and as.data.table() here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20140407/bd90bc79/attachment.html>


More information about the datatable-help mailing list