R Programming - Validating the Strike Rate - Project Writing Assignment Help

Download Solution Order New Solution
Internal Code: 1ABBDC

R Programming Project Writing Assignment Help

Task:  R programming The scorecard in Table 2 is from the first innings of the first cricket test ie Australia vs India 2018 series. http://www.espncricinfo.com/series/18693/scorecard/1144993/australia-vs-india-1st-test-india-in-aus- 2018-19 The columns show: 2
  • Batsman: The name of the batsman.
  • How Out: How the batsman was given out.
  • Runs: The number of runs made by the batsman.
  • Balls: The number of balls faced by the batsman.
  • 4s: The number of 4s hit by the batsman.
  • 6s: The number of 6s hit by the batsman.
  • SR: The batsman’s strike rate (100*Runs/Balls).
Validating the Strike Rate Cricinfo believe that there is a bug in their code that computes the batsman’s strike rate (SR), and so they want you to verify the numbers. Write the code to:
  1. Create a data frame in R containing the data from Table 2. 2. Compute the strike rate using the data frame from the Runs and Balls. 3. Subtract your computed strike rate from the data frame column SR.
Finally, state if your output shows errors in the data, and where the errors occur. Ball Outcome Cricinfo want to create a simple cricket simulator to test their scorecard and so have come to you for help. After a ball is bowled, there are eight possible outcomes. Below we list the eight outcomes and each outcome’s e?ect on the score:
  • 0 runs: add 1 to the ball count
  • 1 run: add 1 to the ball count, add 1 to the run count
  • 2 runs: add 1 to the ball count, add 2 to the run count
  • 4 runs: add 1 to the ball count, add 4 to the run count, add 1 to the 4s count
  • 6 runs: add 1 to the ball count, add 6 to the run count, add 1 to the 6s count
  • Wide: add 1 to the extras count
  • No ball: add 1 to the extras count
  • Out: add 1 to the ball count, mark batsman as out
Cricinfo store a batsman’s record using the variable: state = list(balls = 0, runs = 0, fours = 0, sixes = 0, extras = 0, out = FALSE) Write the function oneBall that takes the input state and one outcome and returns the updated state based on the eight outcomes above. Batsman’s score A batsman keeps facing balls until the batsman is out. To simulate a single batsman, we need to:
  1. Randomly sample one of the eight outcomes,
  2. Update the score state,
  3. Repeat until the outcome is Out.
Write the function oneBatsman that randomly samples one of the eight outcomes from above, updates the score using your function oneBall, then repeats until the outcome is Out. Note that we can randomly sample an outcome using: outcome = sample(c("0 runs", "1 runs", "2 runs", "4 runs", "6 runs", "Wide", "No Ball", "Out"), size = 1) Team Score The final piece of the simulation is to simulate the score for the whole team, and compute the team score. Write a function that contains the code to:
  1. Simulate the scores for 10 batsmen (using the function oneBatsman).
  2. Add the runs and extras from each batsman to obtain the team score.
This R programming Assignment has been solved by our R programming experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style. Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.