I have this table:
and I want to get the rows that are equal to the first three columns, like this:
I've tried these functions, but when I get the index of the lines, r doesn't give the output that I want:
df$obj<-sapply(c("sample1", "sample2", "sample3"), function (comparison) {
df$sample1 == df[comparison]
})
dplyr
suggestion on your previous question:filter(df, sample1 == sample2 & sample1 == sample3)
Note thata
andA
are not the same. If you want a case-insensitive matching, usefilter(df, toupper(sample1) == toupper(sample2) & toupper(sample1) == toupper(sample3))
$\endgroup$