I have three columns ( home_team, away_team, winner).
home_team Away_ team winner
all Stars Bosses Bosses
Amigos Champions Amigos
Avenger Amigos Amigos
I want to create a fourth column named home_or_away that will compare home_team and winner. if home_team is winner then "home" and else "away"
In the future, it's very helpful if you can provide a reproducible example so the data is easy for someone to copy/paste into R. I did the work this time but in the future take a look here to learn how to create a reproducible example: FAQ: How to do a minimal reproducible example ( reprex ) for beginners