hermesh2
2/8/2017 - 9:41 AM

Merge one colum data table

Merge one colum data table

# https://stackoverflow.com/questions/30913338/join-two-data-tables-and-use-only-one-column-from-second-dt-in-r/30913505#30913505?newreg=1be6a677f9174f758402c32e51a84c92
# https://rawgit.com/wiki/Rdatatable/data.table/vignettes/datatable-reference-semantics.html
# https://rawgit.com/wiki/Rdatatable/data.table/vignettes/datatable-keys-fast-subset.html

dt  <- data.table( car = rownames(mtcars), cyl = mtcars$cyl, hp   = mtcars$hp  , key = "car") 
dt2 <- data.table( car = rownames(mtcars), wt  = mtcars$wt , carb = mtcars$carb, key = "car")  

dt[dt2, wt2 := wt]
dt$wt2 - dt2$wt