答案 0 :(得分:0)
您可以先阅读csv文件
excel1<-read.csv("excel1.csv", header=T)
excel2<-read.csv("excel2.csv", header=T)
excel1.excel2<-setdiff(excel1, excel2)
您也可以参考这篇文章来帮助您准备可重复的示例:How to make a great R reproducible example?
答案 1 :(得分:0)
我终于得到了这段代码。当然也许有更好的方法,但这就是你想要的技巧!
excel.1 <- data.frame(V1 = c(4,4,8,6,7), V2 = c(5,3,6,9,2))
excel.2 <- data.frame(V1 = c(7,8,4), V2 = c(2,6,3))
a <- expand.grid(1:nrow(excel.1), 1:nrow(excel.2))
a <- t(a)
log.vec <- matrix(nrow = ncol(a), ncol = ncol(excel.2))
for (comb in 1:ncol(a)){
log.vec[comb, ] <- excel.1[a[1, comb], ] == excel.2[a[2, comb], ]
}
log.vec <- cbind(log.vec, rowSums(log.vec))
equal <- a[, log.vec[, 3] == 2]
new.matrix <- excel.1[-equal[1,], ]