find_matchup: Find a matchup between two or more players

Description Usage Arguments Value Examples

View source: R/players.R

Description

Find the matches between two or more specific opponents. If only players_a is specified all the matches between the players in this set are returned. If both players_a and players_b are specified all the matched betweena player in set a and a player in set b are specified. Matching is case-insensitive.

Usage

1
find_matchup(x, players_a, players_b = players_a)

Arguments

x

A data frame from the tennis package.

players_a

A character vector.

players_a

A character vector.

Value

A subset of x with the matchups between the requested players.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Find all matches between Nadal and Federer:
find_matchup(atp_matches, "Roger Federer", "Rafael Nadal")

# Find all matches between Nadal, Djokovic, and Federer:
find_matchup(atp_matches, c("Roger Federer", "Rafael Nadal", "Novak Djokovic"))

Find all matches that Nadal or Federer played against Djokovic or Murray:
a <- c("Roger Federer", "Rafael Nadal"); b <- c("Novak Djokovic", "Andy Murray")
find_matchup(atp_matches, a, b)

Find all matches that Nadal and Federe played against Djokovic or Murray
and all the matches they played against each other:
find_matchup(atp_matches, a, c(a, b))

EdwinTh/tennis documentation built on Jan. 13, 2020, 2:38 p.m.