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" <[email protected]> wrote in message 
news:[email protected]...
> 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
> [email protected] 



_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to