import names to fit ids in a dataframe

I have a large baseball df. it contains player ids for both the batter and pitcher. it also contains the batter's name. I want to add a column of the pitchers names. their IDs are already in the df. I have a separate df w all player ids and names. what are ways to merge the pitchers names from the separate df into the original df I am using?
thanks for any help

It seems to be a direct application of join functions of dplyr, most likely to be left_join.

You can get more information about these here in the documentation and here in R4DS.

Most probably, base::merge will work as well.

If these do not work, can you please provide a REPRoducible EXample of your problem? It provides more specifics of your problem, and it helps others to understand what problem you are facing.

If you don't know how to do it, take a look at this thread:

1 Like

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