feature_surface: Matrix of surface features

Description Usage Arguments Value Examples

View source: R/feature_matrix.R

Description

Let n be the number of surfaces and m the number of matches . Creates a (2n x m) matrix where the first n rows describe surface features for player 1 and the next n rows describe surface features for player 2. Each column signifies a match and the only non-zero elements of that column are for the 2 rows (one for each player) which describe the surface on which the match was played. The two values for the column will be the performance of player 1 and player 2 respectively on that surface.

Usage

1
feature_surface(my_data, no_matches, player_data, p1_p2, surface, carpet = 'FALSE')

Arguments

my_data

input data.

no_matches

number of matches played.

player_data

player data frame which is the output of function player_data_frame.

p1_p2

a matrix where each column signifies a match and the two rows are the player ids for player 1 and player 2 for that match.

surface

a list of surfaces played on.

carpet

as matches are no longer played on carpet, carpet performance is by default not included. However, carpet can be included by including, carpet == 'TRUE'.

Value

A matrix of players surface features depending on which surface the match is played on.

Examples

1
2
feature_surface(data, no_matches = 1000, player_data, p1_p2, c("Hard","Clay", "Grass"))
feature_surface(data, no_matches = 31205, player_data, p1_p2, c("Hard","Clay", "Grass", "Carpet"), carpet = 'TRUE')

ss15859/tennis.wta documentation built on Jan. 24, 2021, 12:46 a.m.