# Problem 56533. Cricket - You Miss, I Hit (Rank Bowlers by Proportion of Bowled and LBW Wickets)

Which bowlers threaten your stumps the most? Given a table of all wickets taken during some particular set of matches and two thresholds, w and p, return a table of the bowlers who have taken at least w wickets with a proportional of at least p of those wickets being either bowled or LBW. The table returned should be sorted in descending order of this proportion. If bowlers share the same proportion, they should be ordered in descending order of total wickets.
The input table will have two variables, Bowler and Dismissal. Both are string vectors. The first is the names of the bowlers, the second is the type of wicket, which will be from the set: "bowled", "caught", "caught and bowled", "hit wicket", "lbw", "stumped".
The output table should have three variables: Bowler, Wickets, and WWProp. The first is the names of the bowlers (string), the second is the number of wickets taken by each bowler (double), and the third is the proportion of each bowler's wickets that were bowled or LBW.
For example, with thresholds of w = 2, p = 0.5:
b = ["Ben";"Matt";"Renee";"Renee";"Ben";"Ned";"Ben";"Ned"];
w = ["hit wicket";"lbw";"bowled";"lbw";"lbw";"stumped";"bowled";"caught and bowled"];
wickets = table(b,w,'VariableNames',["Bowler","Dismissal"])
wickets =
8×2 table
Bowler Dismissal
_______ ___________________
"Ben" "hit wicket"
"Matt" "lbw"
"Renee" "bowled"
"Renee" "lbw"
"Ben" "lbw"
"Ned" "stumped"
"Ben" "bowled"
"Ned" "caught and bowled"
wwprop = wicketwicketprop(wickets,2,0.5)
wwprop =
2×3 table
Bowler Wickets WWProp
_______ _______ _______
"Renee" 2 1
"Ben" 3 0.66667

### Solution Stats

46.67% Correct | 53.33% Incorrect
Last Solution submitted on Nov 02, 2023

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!