tennis_reshape: Reshape the tennis data from the perspective of one player

Description Usage Arguments Value

View source: R/players.R

Description

Each match will be converted so its from the perspective of one player. When both players of a match are queried, two records will be created from one match. The reshaped data makes it easier to analyse the results of a single player. Function is case-insensitive.

Usage

1

Arguments

x

A data frame from the tennis package.

...

Character string of the full player name(s). Multiple player names are separated by a comma. If empty, all players in the set will be retained (and the data set will double in rows).

Value

For each match played by a requested player a record is created. The columns player, won_lost, and opponent replace the columns winner_name and loser_name. All the other columns containing player information are renamed to either player_ or opponent_ (and p_ or o_) depending to which of the players they belong.


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