Learn R Programming

cricketr (version 0.0.26)

getPlayerDataOppnHA: Return a filtered CSV file for a player against specified opposition, at home/away venues during an interval

Description

This function saves the filtered players data as a CSV file for matches against specified opposition, at home.away venues for a specified interval

Usage

getPlayerDataOppnHA(infile,outfile,dir=".",opposition=c("all"),homeOrAway=c("all"),
                          startDate="2001-01-01",endDate="2019-01-01")

Arguments

infile

The input CSV HA file for the player

outfile

The name of the output CSV file which is filtered file based on opposition,home/away for a period

dir

The name of the directory to store output file

opposition

This is a vector of opposition for e.g. c("Australia","India","South Africa"). Default is c("all")

homeOrAway

This is a vector of "home","away" or "neutral". Default is c("all")

startDate

This is a date from which you would like the data for player "yyyy-mm-dd" format

endDate

This is a end date till which you need data to be filtered of "yyyy-mm-dd" format

Value

dataframe

References

https://www.espncricinfo.com/ci/content/stats/index.html https://gigadom.in/

See Also

teamWinLossStatusVsOpposition batsman4s6s

Examples

Run this code
# NOT RUN {
#Get data for Kohli  against England in 'away' venues in the year 2014
df=getPlayerDataOppnHA(infile="kohliHA.csv",outfile="kohliEAN2014.csv",
            opposition=c("England","Australia","New Zealand"),
homeOrAway=c("away"),startDate="2014-01-01",endDate="2015-01-01")

# Get data for Tendulkar between 2001 and 2002
df1=getPlayerDataOppnHA(file,outfile="tendulkar2001.csv",startDate="2001-01-01",
                                                         endDate="2002-01-01")

# }

Run the code above in your browser using DataLab