Description Usage Arguments Value Examples
View source: R/feature_matrix.R
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.
1 | feature_surface(my_data, no_matches, player_data, p1_p2, surface, carpet = 'FALSE')
|
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'. |
A matrix of players surface features depending on which surface the match is played on.
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')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.