Import data

# csv file
soccer <- read_csv("../00_data/mydata.xlsx")
## Multiple files in zip: reading '[Content_Types].xml'
## Rows: 1 Columns: 1
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
soccer
## # A tibble: 1 × 1
##   `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>`                     
##   <chr>                                                                         
## 1 "<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\…
# excel file
soccer <- read_excel("../00_data/mydata.xlsx")
soccer
## # A tibble: 380 × 22
##    Date      HomeTeam AwayTeam  FTHG  FTAG FTR    HTHG  HTAG HTR   Referee    HS
##    <chr>     <chr>    <chr>    <dbl> <dbl> <chr> <dbl> <dbl> <chr> <chr>   <dbl>
##  1 13/08/20… Brentfo… Arsenal      2     0 H         1     0 H     M Oliv…     8
##  2 14/08/20… Man Uni… Leeds        5     1 H         1     0 H     P Tier…    16
##  3 14/08/20… Burnley  Brighton     1     2 A         1     0 H     D Coote    14
##  4 14/08/20… Chelsea  Crystal…     3     0 H         2     0 H     J Moss     13
##  5 14/08/20… Everton  Southam…     3     1 H         0     1 A     A Madl…    14
##  6 14/08/20… Leicest… Wolves       1     0 H         1     0 H     C Paws…     9
##  7 14/08/20… Watford  Aston V…     3     2 H         2     0 H     M Dean     13
##  8 14/08/20… Norwich  Liverpo…     0     3 A         0     1 A     A Marr…    14
##  9 15/08/20… Newcast… West Ham     2     4 A         2     1 H     M Atki…    17
## 10 15/08/20… Tottenh… Man City     1     0 H         0     0 D     A Tayl…    13
## # ℹ 370 more rows
## # ℹ 11 more variables: AS <dbl>, HST <dbl>, AST <dbl>, HF <dbl>, AF <dbl>,
## #   HC <dbl>, AC <dbl>, HY <dbl>, AY <dbl>, HR <dbl>, AR <dbl>

State one question

How does more shots correlate to increased goals scored?

Plot data

ggplot(data = soccer) +
   geom_point(mapping = aes(x = HS, y = FTHG)) 

Interpret

As expected, the more total shots scored the more likely goals become. To look deeper I’d want to find a way to color code to make it easier to visually track and compare shots to shots on target.