cricketr (version 0.0.23)

WR: This function caculates the wicket rate vs mean number of deliveries

Description

This function caculates the wicket rate vs mean number of deliveries

Usage

WR(file)

Arguments

file

Name of file

Value

None

Details

More details can be found in my short video tutorial in Youtube https://www.youtube.com/watch?v=q9uMPFVsXsI

References

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

Examples

Run this code
# NOT RUN {
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (file) 
{
    bowler <- clean(file)
    wktRate <- NULL
    w <- NULL
    for (i in 0:max(as.numeric(as.character(bowler$Wkts)))) {
        balls <- bowler[bowler$Wkts == i, ]$Overs * 6
        if (length(balls != 0)) {
            wktRate[i] <- lapply(list(balls), mean)
            w[i] <- i
        }
    }
    a <- sapply(wktRate, is.null)
    wktRate[a] <- NaN
    wktRate
  }
# }

Run the code above in your browser using DataLab