[datatable-help] key disappears after merge of data tables

Joseph Voelkel jgvcqa at rit.edu
Tue Jan 18 16:04:36 CET 2011


Thanks for the update, Matthew.

-----Original Message-----
From: Matthew Dowle [mailto:mdowlenoreply at virginmedia.com] On Behalf Of Matthew Dowle
Sent: Monday, January 17, 2011 6:15 PM
To: Joseph Voelkel
Cc: datatable-help at lists.r-forge.r-project.org
Subject: Re: [datatable-help] key disappears after merge of data tables

Just to update this thread, Tom added this FR(#1244). The result of
merge is now keyed when all=FALSE, too. In 1.5.2.
Matthew

On Thu, 2011-01-06 at 10:40 +0000, Matthew Dowle wrote:
> If all is TRUE (or just all.x or all.y is TRUE) then result is keyed.
> 
> Why the key is not set when all is FALSE (default) I'm not sure.  Tom - can 
> you remember?  Something to do with NAs in keys seems to ring a bell.
> 
> Matthew
> 
> 
> "Joseph Voelkel" <jgvcqa at rit.edu> wrote in message 
> news:70EFCDD908F9264785FA08EC3A47132016CC45F47C at ex02mail01.ad.rit.edu...
> > See code below. When two data tables are merged (by their key 
> > variable(s)), that key disappears in the resulting table. While this is 
> > probably not strictly a bug, it would seem that the user would most likely 
> > want to preserve the key in the output (especially if just enlarging the 
> > original data table, e.g. dt2<-merge(dt1,dt2).)
> >
> >
> >> dt1<-data.table(a=1:6,b=11:16,key="a")
> >> dt2<-data.table(a=1:6,c=21:26,key="a")
> >> dt3<-merge(dt1,dt2)
> >>
> >>
> >     NAME NROW MB COLS  KEY
> > [1,] dt1     6 1  a,b   a
> > [2,] dt2     6 1  a,c   a
> > [3,] dt3     6 1  a,b,c
> > Total: 3MB
> >
> >
> > Joseph G. Voelkel, Ph.D.
> > Professor, Center for Quality and Applied Statistics
> > Kate Gleason College of Engineering
> > Rochester Institute of Technology
> > V 585-475-2231
> > F 585-475-5959
> > joseph.voelkel at rit.edu 
> 
> 
> 
> _______________________________________________
> 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




More information about the datatable-help mailing list