在R中,查找两个文件是否不同 [英] In R, find whether two files differ

查看:88
本文介绍了在R中,查找两个文件是否不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一种纯粹的R方法来测试两个任意文件是否不同。因此,等效于Unix中的 diff -q ,但应在Windows上运行且没有外部依赖项。

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 external dependencies.

我知道 tools :: Rdiff ,但它似乎只想处理R输出文件

I'm aware of tools::Rdiff, but it seems to only want to deal with R output files and complains loudly if I feed it something else.

推荐答案

如果文件太大,则不使用内存:

Without using memory, if the files are too large:

library(tools)
md5sum("file_1.txt") == md5sum("file_2.txt")

这篇关于在R中,查找两个文件是否不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆