clean: Cleaning function

View source: R/functions.R

cleanR Documentation

Cleaning function

Description

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

Usage

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


data(atp_2019) 
db_clean<-clean(atp_2019)
str(db_clean)


welo documentation built on May 29, 2024, 8:38 a.m.

Related to clean in welo...