显示文件或对象之间的差异 [英] Show difference between files or objects

查看:52
本文介绍了显示文件或对象之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

R中是否可以比较对象并返回有用的信息(例如差异在哪里)?我需要比较文件,但愿意将它们读入data.frames.从命令行可以更好地处理此问题,但是我想将测试封装到一个R脚本中.我的下一个尝试是使用ddply将每一行发送到compare()函数并返回"FALSE"行的行号,但这仅在您插入或删除一个行之前起作用,然后其他所有内容都变为"FALSE".

Is there a way in R to compare objects and return something useful like where the differences are? I need to compare files, but am willing to read them in to data.frames. This might just be handled better from the command line, but I would like to encapsulate my testing into one R script. My next attempt will be to use ddply to send each line to a compare() function and return the line numbers of the "FALSE" lines, but that only works until you have one insertion or deletion, then everything else becomes "FALSE".

谢谢.

文件包含数字和字符数据的组合.

the files contain a combination of numeric and character data.

推荐答案

system(paste("fc",< file1> ;,< file2> ;,> difference.txt"))

似乎可以正常工作.我的Google-fu今天下班了.

seems to work. My Google-fu was off today.

这篇关于显示文件或对象之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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