text1 <- read.csv("file1.txt", header = T)
text2 <- read.delim("file2.txt", heade=T)
两个文件有共同的列名 Name
如果没有就用 colnames(text1) <- c("Name", "OtherCol") 重命名
data_1 <- merge(text1, text2, by = "Name", all = T)
write.table(data_1, file = "result_data.txt", quote = FALSE, sep = "\t", row.names = FALSE)
原文地址:http://matrix6ro.blog.51cto.com/1746429/1775448