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

Joseph Voelkel jgvcqa at rit.edu
Thu Jan 6 00:20:49 CET 2011


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



More information about the datatable-help mailing list