【发布时间】:2014-09-05 06:29:28
【问题描述】:
我进行了很多搜索并自己尝试过,但找不到针对此特定问题的解决方案。
对于每 2 行('key' 很常见),我必须在每一列中找到不匹配的地方,并以如下所示的有条理的方式突出显示它们。
输出应采用以下格式:
COLUMN_NAME is not matching for records below:
PRINT COMPLETE RECORDS
...
COLUMN_NAME is not matching for records below:
PRINT COMPLETE RECORDS
...
COLUMN_NAME is not matching for records below:
PRINT COMPLETE RECORDS
...
输入数据(它是一个数据框):
key V1 V2 V3 V4 V5
a1 1 2 3 4 5
a1 1 3 9 4 5
a5 2 1 4 7 5
a5 2 1 4 7 6
a6 7 6 8 9 6
a6 7 6 3 9 6
a9 7 6 8 9 4
a9 7 6 8 9 3
输出:
V2 is not matching for records below:
key V1 V2 V3 V4 V5
a1 1 2 3 4 5
a1 1 3 9 4 5
V3 is not matching for records below:
key V1 V2 V3 V4 V5
a1 1 2 3 4 5
a1 1 3 9 4 5
a6 7 6 8 9 6
a6 7 6 3 9 6
V5 is not matching for records below:
key V1 V2 V3 V4 V5
a5 2 1 4 7 5
a5 2 1 4 7 6
a9 7 6 8 9 4
a9 7 6 8 9 3
我是 R 的初学者,所以请善待 :)
【问题讨论】:
标签: r dataframe compare match apply