<div dir="ltr">I think that key(g_ctpty[links]) == key(g_ctpty) == "ctpty_head", which is used when you do your second merge with [, instead of "iss_head". You can check this by running key(g_ctpty[links]) . --Frank</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 17, 2013 at 1:57 AM, Arunkumar Srinivasan <span dir="ltr"><<a href="mailto:aragorn168b@gmail.com" target="_blank">aragorn168b@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>Since you have the data as well, why not provide it (a small part at least with which your issue is reproducible)? Isn't it much easier than to ask everyone who's willing to help to create a data and test your code?</div>
<div></div>
</div>
<div><div><br></div><div>Arun</div><div><br></div></div><div class="HOEnZb"><div class="h5">
<p style="color:#a0a0a8">On Monday, June 17, 2013 at 8:54 AM, Ivan Alves wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px">
<span><div><div><div>Dear all,</div><div><br></div><div>I am not sure I understand the syntax for merging data.tables. I have keyed the two 'satelite' tables from which I want to match information to the main table 'links'</div>
<div><br></div><div> g_ctpty <- gultimate[,list(ctpty_head,ctpty_cty)]</div><div> setkey(g_ctpty,ctpty_head)</div><div> g_iss <- gultimate[,list(iss_head,iss_cty)]</div><div> setkey(g_iss,iss_head)</div><div><br>
</div><div>Why are the two below not equivalent?</div><div><br></div><div>This works:</div><div><br></div><div> data = merge(</div><div> merge(links, g_ctpty, all.x = TRUE, by = "ctpty_head"),</div><div>
g_iss,</div><div> all.x = TRUE, by = "iss_head"</div><div> ),</div><div><br></div><div>And this does not:</div><div><br></div><div> data = g_iss[g_ctpty[links]],</div><div><br></div><div>
Any guidance would be appreciated.</div><div>Kind regards,</div><div>Ivan</div><div>_______________________________________________</div><div>datatable-help mailing list</div><div><a href="mailto:datatable-help@lists.r-forge.r-project.org" target="_blank">datatable-help@lists.r-forge.r-project.org</a></div>
<div><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a></div></div></div></span>
</blockquote>
<div>
<br>
</div>
</div></div><br>_______________________________________________<br>
datatable-help mailing list<br>
<a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br></blockquote></div><br></div>