0

I would like to merge two dataframes based on two conditions, one of which examines the percent match across two rows. In the following example, I would like to force a perfect match across the variable x and a match across y based on if there is any unique letter match:

f1 <- data.frame(x = c(1,2,3), y = c("aa", "ff", "cd"), z = c(4,5,6))
f2 <- data.frame(x = c(1,2,3), y = c("aa", "bb", "cc"), z = c(7,9,10))

To produce:

1 1  aa   4  aa   7
3 3  cd   6  cc  10

Ultimately, I would like to figure out how to include a function in the merge that looks through conditions. Thanks.

coding_heart
  • 1,225
  • 2
  • 22
  • 41

0 Answers0