Merging multiple data.tables

Alex picture Alex · Nov 7, 2012 · Viewed 27k times · Source

I am aware that one can merge (join) two data.table with the merge function or the [.data.table function. However, if I have say 10, data.tables and want to use do.call to merge them all together, is there a function that would do this? Currently I resort to do.call(cbind, ...) which works for only very special cases.

Answer

Matt Dowle picture Matt Dowle · Nov 7, 2012

Not sure, but maybe (untested) :

Reduce(merge,list(DT1,DT2,DT3,...))