Get Common Team Mates For Named Players

get_colleagues(all_players, players)

Arguments

all_players

Data.frame. Data fetched from Transfermarkt with get_players.

players

Character vector. One or more player names for whom to return common team mates from the all_players data.frame. See details.

Value

A data.frame with a row per player and season.

Details

Pass one player name to the players argument to fetch all of their team mates in the dataset. Pass multiple players to return common team mates and they seasons they played together.

Examples

if (FALSE) {
# Fetch player data from Transfermarkt
epl_players <- get_players(1992:2020, "England")

# Return all team mate data for one named player
get_colleagues(epl_players, "James Milner")

# Return data for all team mates in common for named players
get_colleagues(
  epl_players,
  c("Mark Viduka", "Kevin Phillips", "Nicky Butt")
)
}