Duckworth-Lewis-Stern calculator to calculate the revised target

0 votes

With the Cricket World Cup going on, I wanted to create a Duckworth-Lewis calculator of my own for One Day Internationals using R.

This is a challenge I assigned myself, to push myself in understanding more on R, and what I could do. Duckworth-Lewis is an algorithm used in cricket when unexpected delays (notably bad weather) takes centre stage. The algorithm (in One Day Internationals) involves calculating Team 2's Par Score, which is where 'Team 2 Target' equals 'Team 1 Score' times the quotient of 'Team 2 Resources' and 'Team 1 Resources', and we add 1 to find the target (otherwise it creates room for a South Africa 2003 World Cup scenario).

team2_target = function(team1_score, team1_resources, team2_resources) {
  return((team1_score * (team2_resources/team1_resources) + 1)
}

I want to make my function use the number of wickets lost, as well as the overs remaining to calculate the 'Team 2 Resources' variable. For example, if Team 1 scored 277 out of its full 50 overs and Team 2 scored 240, with the loss of 4 wickets after 40 overs, I want to be able to use the 'Overs' and 'Wickets Lost' as variables. It sounds really simple, but both these factors matter, and if either of my desired variables change, the team2_resources variable itself will change

Feb 24, 2022 in Database by Edureka
• 13,690 points
545 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Database

0 votes
2 answers

What are the ways to get the count of records in a table

With the help of the SQL count ...READ MORE

answered Aug 20, 2020 in Database by Okugbe
• 280 points
4,015 views
0 votes
2 answers

Write a SQL query to find the names of employees that begin with ‘S’

Select ename From emp Where ename like"s%"; READ MORE

answered Oct 7, 2021 in Database by anonymous
27,243 views
0 votes
1 answer

What is the SQL query to get the third highest salary of an employee from employee_table

You can try out something like this: SELECT ...READ MORE

answered Sep 27, 2018 in Database by Sahiti
• 6,370 points
12,701 views
0 votes
1 answer

What are the steps performed by Migration Wizard while migrating a database to MySQL?

The following are the steps  performed by ...READ MORE

answered Dec 10, 2018 in Database by Sahiti
• 6,370 points
933 views
0 votes
1 answer

How to display the queries executed by a particular user in MySQL?

From the version 5.1.7 onward, MySQL allows ...READ MORE

answered Mar 7, 2019 in Database by Mishti
• 480 points
4,421 views
0 votes
1 answer
0 votes
1 answer

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

answered Dec 18, 2017 in Data Analytics by Sudhir
• 1,570 points
1,047 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
1,224 views
0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
5,909 views
0 votes
1 answer

Left Join and Right Join using "dplyr"

The below is the code to perform ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
1,156 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP