I would like a pure R way to test whether two arbitrary files are different. So, the equivalent to diff -q in Unix, but should work on Windows and without exter
Example solution: (Using all.equals utility from: https://stat.ethz.ch/R-manual/R-devel/library/base/html/all.equal.html)
filenameForA <- "my_file_A.txt"
filenameForB <- "my_file_B.txt"
all.equal(readLines(filenameForA), readLines(filenameForB))
Note, that
readLines(filename)
reads all the lines from given file specified by filename, then all.equal can figure out if the files differ or not.
Make sure to read the documentation from above to understand fully. I've to admit, that if the files are very large, this might not be the best option.