[datatable-help] merging syntax
Frank Erickson
FErickson at psu.edu
Mon Jun 17 14:36:38 CEST 2013
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
On Mon, Jun 17, 2013 at 1:57 AM, Arunkumar Srinivasan <aragorn168b at gmail.com
> wrote:
> 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?
>
> Arun
>
> On Monday, June 17, 2013 at 8:54 AM, Ivan Alves wrote:
>
> Dear all,
>
> 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'
>
> g_ctpty <- gultimate[,list(ctpty_head,ctpty_cty)]
> setkey(g_ctpty,ctpty_head)
> g_iss <- gultimate[,list(iss_head,iss_cty)]
> setkey(g_iss,iss_head)
>
> Why are the two below not equivalent?
>
> This works:
>
> data = merge(
> merge(links, g_ctpty, all.x = TRUE, by = "ctpty_head"),
> g_iss,
> all.x = TRUE, by = "iss_head"
> ),
>
> And this does not:
>
> data = g_iss[g_ctpty[links]],
>
> Any guidance would be appreciated.
> Kind regards,
> Ivan
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>
>
>
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20130617/b8d2004e/attachment.html>
More information about the datatable-help
mailing list