如何使用 R 删除数据框中具有相同字符串条目的两列或更多列的行

How to delete rows in a Dataframe that have same string entries two or more columns Using R

我有这个数据集,我想删除在以下数据框中第 1 列和第 2 列中具有相同条目的行

         Terms    Terms.1 Freq
1    education  education    3
2    enrolment  education    2
3    household  education    1
4       policy  education    2
5      primary  education    3
6       school  education    3
7   curriculum  education    1
8     research  education    2
9      teacher  education    2
10    teaching  education    2
11   education  enrolment    2
12   enrolment  enrolment    2
13   household  enrolment    1
14      policy  enrolment    1
15     primary  enrolment    2
16      school  enrolment    2
17  curriculum  enrolment    0
18    research  enrolment    1
19     teacher  enrolment    1
20    teaching  enrolment    1
21   education  household    1
22   enrolment  household    1
23   household  household    1
24      policy  household    1
25     primary  household    1
26      school  household    1
27  curriculum  household    0
28    research  household    0
29     teacher  household    0
30    teaching  household    0
31   education     policy    2
32   enrolment     policy    1
33   household     policy    1
34      policy     policy    2
35     primary     policy    2
36      school     policy    2
37  curriculum     policy    1
38    research     policy    1
39     teacher     policy    1
40    teaching     policy    1

预期的数据帧应跳过 1st12th23rd34th45th 这里有任何想法

df %>% 
  dplyr::filter(Terms != Terms.1)

        Terms   Terms.1 Freq
2   enrolment education    2
3   household education    1
4      policy education    2
5     primary education    3
6      school education    3
7  curriculum education    1
8    research education    2
9     teacher education    2
10   teaching education    2
11  education enrolment    2
13  household enrolment    1
14     policy enrolment    1
15    primary enrolment    2
16     school enrolment    2
17 curriculum enrolment    0
18   research enrolment    1
19    teacher enrolment    1
20   teaching enrolment    1
21  education household    1
22  enrolment household    1
24     policy household    1
25    primary household    1
26     school household    1
27 curriculum household    0
28   research household    0
29    teacher household    0
30   teaching household    0
31  education    policy    2
32  enrolment    policy    1
33  household    policy    1
35    primary    policy    2
36     school    policy    2
37 curriculum    policy    1
38   research    policy    1
39    teacher    policy    1
40   teaching    policy    1

或仅使用基数 R:

df[df$Terms != df$Terms.1,]