Here is my sample code:
DF$Owner <- ifelse (ExcelData$Brand %in% Reference$Brand, Reference$Owner, "NULL")
Basically what I'm trying to do is to identify whether there is a brand from
ExcelData to Reference. If there is then I'll get its owner
Example: In the
ExcelData there is a brand 'Baja', there is also a brand 'Baja' in the reference file. Now with the logic of %in% I should get the owner of brand 'Baja' which in this case is 'AMBC01' but the owner that I get when running the code is different.
Now I'm thinking that maybe I need to track the row or anything in order to get the right owner for each identified brand.
I hope that you can understand the explanation of my problem, if there are questions please comment.