Merging Dataframes.

I am trying to merge 2 data frames by a common column called Player ( i.e: character).
however, not that
dim(df1) = 45 x3
dim(df2) = 596 x6
Code used: merge(df1,df2,all.x=TRUE)

After merging, output gives some NA entries. I manually cross checked in .csv file for some of the NA entries, those actually exist in both df1 & df2. Additionally, when I used dplyr filter method to cross check those players existence in df2, returned a value "0".

Any suggestions guys!?!

did you try to use this one:
merge(df1, df2, by = "ID", all.x = TRUE)

Yeah actually, that was the method I tried.

I am suspecting is it could be a space created in the players names in data frame2 which is not matching with df1 entries?? If so, is there any way to inspect and solve it?

you can remove the space in player column them use the code.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.