how to do iterative match over dataframe rows in R?


Welcome to the RStudio community!

Your data and explanation are a bit confusing. You show a very small example of input and output, but then you start talking about B3 - B5 which is mentioned nowhere in the data.

I suggest you create a reprex so we can try and help you out. A reprex consists of the minimal code and data needed to recreate the issue/question you're having. You can find instructions how to build and share one here:

Good luck,