How to fuzzy join 2 dataframes on 2 variables with differing “fuzzy logic”?
问题 # example a <- data.frame(name=c("A","B","C"), KW=c(201902,201904,201905),price=c(1.99,3.02,5.00)) b <- data.frame(KW=c(201903,201904,201904),price=c(1.98,3.00,5.00),name=c("a","b","c")) I want to match a and b with fuzzy logic, using the variables KW and price. I want to allow a tolerance of +/- 1 for KW and a tolerance for +/- 0.02 in price. The desired outcome should look like this: name.x KW.x price.x KW.y price.y name.y 1 A 201902 1.99 201903 1.98 a 2 B 201904 3.02 201904 3.00 b 3 C