setwd("D:/Qunar/R")
first <- read.table("old_cash.txt", header = FALSE)
first <- first[,1]
second <- read.table("new_cash.txt", header = FALSE)
second <- second[,1]
dif <- setdiff(first, second)
uni <- union(first, second)
inter <- intersect(first, second)
write.table(dif, file = "D:/Qunar/R/output/dif.txt", row.names= F, col.names= "A-B", quote = F)
write.table(uni, file = "D:/Qunar/R/output/union.txt", row.names= F, col.names= "A+B", quote = F)
write.table(inter, file = "D:/Qunar/R/output/intersect.txt", row.names= F, col.names= "A交B", quote = F)
网友评论