This question already has an answer here:
- Find rows in a data frame where two columns are equal 1 answer
I have a table:
df <- read.table(text="
a b 5
a a 2
c a 3
d d 2
a a 1
b d 2 ")
colnames(df) <- c("Gen1","Gen2", "N")
I would like to remove the rows when Gen1 = Gen2. For example I would get for this example:
result <- read.table(text="
a b 5
c a 3
b d 2 ")
colnames(df) <- c("Gen1","Gen2", "N")
I tried with duplicated but duplicate is working per rows, not columns.