sample_colleagues.Rd
Sample From Named Players' Common Team Mates
sample_colleagues(all_players, players, n = NULL)
Data.frame. Data fetched from
Transfermarkt with
get_players
.
Character vector. One or more player names for whom to return
common team mates from the all_players
data.frame. See details.
Numeric. Number of team-mates' names to return. See details.
A character vector of player names.
Pass one player name to the players
argument to sample from all of
their team mates in the dataset. Pass multiple players to sample from
common team mates.
The default number of player names returned, n
, by will depend on the
number of players supplied to the players
argument: one input name
will result in n = 5
; multiple input names will result in
n = 1
.
if (FALSE) {
# Fetch player data from Transfermarkt
epl_players <- get_players(1992:2020, "England")
# Return several team mates for one named player
sample_colleagues(epl_players, "James Milner", n = 5)
# Return one team mate in common for named players
sample_colleagues(
epl_players,
c("Mark Viduka", "Kevin Phillips", "Nicky Butt"),
n = 1
)
}