I'm looking to see how I can join one data frame to another based on the names in a specific column
For example: DF1 is:
Name | Fruits | Table |
---|---|---|
John | Apple | Two |
Megan | Apple | Three |
Joe | Grape | One |
Yu | Tomato | Three |
I have another DF2 that has:
Invite | Age | Name |
---|---|---|
RSVP | 21 | John |
RSVP | 12 | Yu |
Guest | 19 | Joe |
Guest | 10 | Joseph |
I want to compare the DF2$Name in DF2 to match the names in DF1, even though it is out of order, and then based on what names match, to create a new data set that includes the Invite and Name status on the left join of DF1 (exclude age), so end result would look like:
DF3: (the info for each persons name will follow suit and be part of that row as well)
Invite | Name | Fruits | Table |
---|---|---|---|
RSVP | John | Apple | Two |
RSVP | Yu | Tomato | Three |
Guest | Joe | Grape | One |
*(Joseph from DF1 is not included because it did not have any match with DF2)
Hopefully this makes sense. Thank you