Quantcast
Channel: R data.table merge tables grouping by multiple columns - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by eddi for R data.table merge tables grouping by multiple columns

Use setkeyv:setkeyv(dt1, letters[-which(letters=="z")])setkeyv(dt2, letters[-which(letters=="z")])dt1[dt2]

View Article



Answer by bjoseph for R data.table merge tables grouping by multiple columns

If you know the name of the different column this worksmerge(dt1,dt2,names(dt1)[-grep("z",names(dt1))])It also preserves the two original differing columns as dt$z.x and dt$z.y

View Article

R data.table merge tables grouping by multiple columns

I have two huge data tables (dt1 and dt2) that are almost identical except for 1 column. I want to join the tables by the p-1 columns, where p <- ncol(dt1). Should I setkey() to the p-1 columns and...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images