For a project, I have 2 data frames that need to be merged on Investor Name.
Df1 contains information on firms and 5 investors names (different columns; Investor 1, Investor 2, ..., Investor 5) Df2 contains information on specific investors.
I want to check if the investor name in df2 is among one of the five investor's names of a firm in df1, and then merge that information. In other words, I want to add investor info of df2 to each row in df1.
Example: Firm X in DF1 has Investor A, B, C, D, and E (5 columns with names) DF2 contains information on investor B. Thus, I want to merge on the 'name' of Investor B to add the investor information to the row of Firm X.
How should I create a merge like this?
I tried this, but the number of columns needs to be equal in this statement
df_merge <- merge(df1, df2, by.x=c("Investor1", "Investor2", "Investor3", "Investor4", "Investor5"), by.y=c("Investor.Name"))