Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merging multiple data.tables

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.

like image 883
Alex Avatar asked Nov 07 '12 16:11

Alex


People also ask

How do I merge two data tables in R?

To join two data frames (datasets) vertically, use the rbind function. The two data frames must have the same variables, but they do not have to be in the same order. If data frameA has variables that data frameB does not, then either: Delete the extra variables in data frameA or.

Can you merge tables in Excel?

You can merge (combine) rows from one table into another simply by pasting the data in the first empty cells below the target table. The table will increase in size to include the new rows.


1 Answers

Not sure, but maybe (untested) :

Reduce(merge,list(DT1,DT2,DT3,...)) 
like image 199
Matt Dowle Avatar answered Nov 04 '22 20:11

Matt Dowle