-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
93 lines (69 loc) · 2.16 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# howzatR
<!-- badges: start -->
[](https://CRAN.R-project.org/package=howzatR)
<!-- badges: end -->
The goal of howzatR is to provide useful functions for cricket analysis & exploratory.
## Installation
You can install a stable version of howzatR using R/Rstudio with:
``` r
install.packages("howzatR")
```
You can install the development version of howzatR from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("lukelockley/howzatR")
```
## Example - Batters Analysis
This is a basic example how to use the batting functionality:
```{r example - batters analysis}
library(howzatR)
library(dplyr)
## Basic Batting dataset
bat_raw_df
## Analysis
bat_df <- bat_raw_df %>%
mutate(
Outs = Inns - NO,
Average = bat_avg(runs_scored = Runs_Scored, no_dismissals = Outs),
Strike_Rate = bat_sr(runs_scored = Runs_Scored, balls_faced = Balls_Faced)
)
## Results
bat_df
```
## Example - Bowling Analysis
This is a basic example how to use the bowling functionality
```{r example - bowling analysis}
library(howzatR)
library(dplyr)
## Basic Bowling dataset
bowl_raw_df
## Analysis
bowl_df <- bowl_raw_df %>%
mutate(
Economy_overs = bowl_econ(balls_bowled = Balls_Bowled, runs_conceded = Runs_Conceded, type = "overs"),
Economy_sets = bowl_econ(balls_bowled = Balls_Bowled, runs_conceded = Runs_Conceded, type = "sets"),
Economy_hundred = bowl_econ(balls_bowled = Balls_Bowled, runs_conceded = Runs_Conceded, type = "per_100"),
Average = bowl_avg(runs_conceded = Runs_Conceded, wickets_taken = Wickets),
Strike_Rate = bowl_sr(balls_bowled = Balls_Bowled, wickets_taken = Wickets),
Overs = balls_to_overs(balls = Balls_Bowled)
) %>%
select(
Player, Balls_Bowled, Overs, Runs_Conceded,
Wickets, Economy_overs, Economy_sets, Economy_hundred,
Average, Strike_Rate
)
## Results
bowl_df
```