[datatable-help] merging syntax

Ivan Alves papucho at me.com
Mon Jun 17 08:54:50 CEST 2013


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


More information about the datatable-help mailing list