0

I want to check whether 2 csv files have the same content, even though there are permutations in columns or rows between them.

I tried to check the row names, and the colnames, but yet I don't know how to manage the content difference if there are permutations between columns or rows in the 2 csv files,

A <- read.csv(args[6])
B<- read.csv(args[7])

set1=as.list(colnames(A))
set2=as.list(colnames(B))
if(length(setdiff(set1, set2))>0)cat("\n ==================>the files do not have the same colnames \n")  else cat(" similar col names")
context_matrix1 <- as.matrix(A)
set1=as.list(context_matrix1[,1])
context_matrix2 <- as.matrix(B)
set2=as.list(context_matrix2[,1])
if(length(setdiff(set1, set2))>0)cat("\n ==================>the files do not have the same rownames \n")  else cat(" similar rownames names")

Any help would be appreciated

Thanks

C. DAVID
  • 61
  • 1
  • 7
  • 1
    can you sort A & B by colname and then by rowname? maybe give a sample of data? – Zahiro Mor Feb 14 '18 at 13:16
  • also - you can use `idenitcal(A$name1,B$name1) ` – Zahiro Mor Feb 14 '18 at 13:17
  • 1
    When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Feb 14 '18 at 15:15

0 Answers0