Efficiently joining more than 2 data.tables
<p>I was wondering if there is a memory efficient way to join n data.tables (or data frames). For example, if I have the following 4 data.tables:</p>

<pre><code>df1 = data.table(group = c(1L,2L,3L),value = rnorm(3),key = "group")
df2 = data.table(group = c(2L,1L,3L),value2 = rnorm(3),key = "group")
df3 = data.table(group = c(3L,2L,1L),value3 = rnorm(3),key = "group")
df4 = data.table(group = c(1L,3L,2L),value4 = rnorm(3),key = "group")
</code></pre>

<p>I could merge them like so:</p>

<pre><code>merge(df1,merge(df2,merge(df3,df4)))
</code></pre>

<p>but that does not seem like an optimal solution. I might potentially have many data.tables that need to be merged. Is there a way to generalize the above without copying each successive merge to memory? Is there an already accepted way outside of data.table to do this?</p>