R语言 在R中实现vlookup的功能
一、merge
data_merge <- (merge(data_name, data_inform, by = 'id'))
二、plyr的join
library(plyr)
data_join <- join(data_name, data_inform, by = "id")
三、sqldf
library(sqldf)
data_sqldf1 <- sqldf(
"SELECT data_name.name, data_inform.age
FROM data_name INNER JOIN data_inform
ON ladata_name.id= data_inform.id"
)
data_sqldf2 <- sqldf("SELECT * FROM data_name LEFT JOIN data_inform USING (id)")
以上为全部内容■■■