title: R: do.call with merge and eapply
body: <p>I am merging two xts objects with join=&quot;left&quot; i.e. (all rows in the left object, and those that match in the right). I loaded these objectd in myEnv.</p>
  <pre><code>library(quantmod)
  myEnv &lt;- new.env()
  getSymbols(&quot;AAPL;FB&quot;, env=myEnv)
  [1] &quot;AAPL&quot; &quot;FB&quot;  
  MainXTS &lt;- do.call(merge, c(eapply(myEnv, Cl), join = &quot;left&quot;))
  head(MainXTS)
             AAPL.Close FB.Close
  2007-01-03   2.992857       NA
  2007-01-04   3.059286       NA
  2007-01-05   3.037500       NA
  2007-01-08   3.052500       NA
  2007-01-09   3.306072       NA
  2007-01-10   3.464286       NA
  range(index(myEnv$AAPL))
  [1] &quot;2007-01-03&quot; &quot;2020-10-27&quot;
  range(index(myEnv$FB))
  [1] &quot;2012-05-18&quot; &quot;2020-10-27&quot;
  </code></pre>
  <p>So far it is working as expected since the time index in above merged object is being picked up from APPL. The issue is that when I change the order of the tickers so that FB comes first, the merged object still picks up time indexes from AAPL.</p>
  <pre><code>myEnv &lt;- new.env()
  getSymbols(&quot;FB;AAPL&quot;, env=myEnv)
  [1] &quot;FB&quot;   &quot;AAPL&quot;
  MainXTS &lt;- do.call(merge, c(eapply(myEnv, Cl), join = &quot;left&quot;))
  head(MainXTS)
             AAPL.Close FB.Close
  2007-01-03   2.992857       NA
  2007-01-04   3.059286       NA
  2007-01-05   3.037500       NA
  2007-01-08   3.052500       NA
  2007-01-09   3.306072       NA
  2007-01-10   3.464286       NA
  </code></pre>
  <p>I was expecting the time index to be picked up from FB. Does any one know what I am missing?</p>
  <p>I think this has something to do with the fact that the order of objects being loaded is the same and in both cases above it is:</p>
  <pre><code>ls(myEnv)
  [1] &quot;AAPL&quot; &quot;FB&quot;  
  </code></pre>