r - Link id with name -
this question has answer here: how join (merge) data frames (inner, outer, left, right)? 11 answers i know quite simple question i'm still quite new r. if have 2 tables this id = c(1,2,3,4,5,6) cost = c(11,22,33,44,55,66) name =c("aa","bb","cc","dd","ee","ff") tableone = cbind (id, cost) tabletwo = cbind(name,id) how can add correct names (as in tabletwo) tableone costs? in reality table1 more complex multiple duplications etc. here's way using data.table package: load package: library(data.table) load vectors had them defined: id <- c(1,2,3,4,5,6) cost <- c(11,22,33,44,55,66) name <- c("aa","bb","cc","dd","ee","ff") turn vectors single column data tables: id.dt<-data.table(id) setnames(id.dt,"id...