clean: Cleaning function

Description Usage Arguments Details Value Examples

View source: R/functions.R

Description

Cleans the dataset in order to create a suitable data.frame ready to be used in the welofit function.

Usage

1
clean(x, MNM = 10, MRANK = 500)

Arguments

x

Data to be cleaned. It must be a data.frame coming from http://www.tennis-data.co.uk/.

MNM

optional Minimum number of matches played by each player to include in the cleaned dataset. Default to 10. This means that each player has to play at least 10 matches

MRANK

optional Maximum rank of the players to consider. Default to 500. This means that all the matches with players with ranks greater than 500 are dropped

Details

The cleaning operations are:

  1. Remove all the uncompleted matches;

  2. Remove all the NAs from B365 odds;

  3. Remove all the NAs from the variable "ranking";

  4. Remove all the NAs from the variable "games";

  5. Remove all the NAs from the variable "sets";

  6. Remove all the matches where the B365 odds are equal;

  7. Define players i and j and their outcomes (Y_i and Y_j);

  8. Remove all the matches of players who played less than MNM matches;

  9. Remove all the matches of players with rank greater than MRANK;

  10. Sort the matches by date.

Value

Data.frame cleaned

Examples

1
2
3
data(atp_2019) 
db_clean<-clean(atp_2019)
str(db_clean)

welo documentation built on Oct. 12, 2021, 5:08 p.m.

Related to clean in welo...