1 데이터

worldfootballR 데이터 팩키지를 사용해서 다음 웹사이트에서 축구 데이터를 가져올 수 있다.

1.1 worldfootballR 팩키지 설치

# devtools::install_github("JaseZiv/worldfootballR")
library(worldfootballR)

1.2 understatr 팩키지 설치

# devtools::install_github("ewenme/understatr")
library(understatr)

2 데이터 불러오기 - understatr

2.1 리그 메타 데이터

축구리그 데이터를 확인해보자.

get_leagues_meta()
# A tibble: 42 x 4
   league_name  year season    url                                      
   <chr>       <dbl> <chr>     <chr>                                    
 1 EPL          2020 2020/2021 https://understat.com/league/EPL/2020    
 2 EPL          2019 2019/2020 https://understat.com/league/EPL/2019    
 3 EPL          2018 2018/2019 https://understat.com/league/EPL/2018    
 4 EPL          2017 2017/2018 https://understat.com/league/EPL/2017    
 5 EPL          2016 2016/2017 https://understat.com/league/EPL/2016    
 6 EPL          2015 2015/2016 https://understat.com/league/EPL/2015    
 7 EPL          2014 2014/2015 https://understat.com/league/EPL/2014    
 8 La liga      2020 2020/2021 https://understat.com/league/La liga/2020
 9 La liga      2019 2019/2020 https://understat.com/league/La liga/2019
10 La liga      2018 2018/2019 https://understat.com/league/La liga/2018
# ... with 32 more rows

2.2 리그 순위

EPL 2020시즌 팀순위를 살펴보자.

epl_league_2020 <- get_league_teams_stats(league_name = "EPL", year = 2020)

epl_league_2020 %>% 
  group_by(team_name) %>% 
  summarise(pts = sum(pts),
            wins = sum(wins),
            draws = sum(draws),
            loses = sum(loses)) %>% 
  arrange(desc(pts)) %>% 
  reactable::reactable()

2.3 팀 데이터

손흥민이 뛰었던 2020 시즌 토트넘에서 손흥민을 찾아보자.

tottenham <- get_team_players_stats(team_name = "Tottenham", year = 2020)

tottenham %>% 
  reactable::reactable()

2.4 선수 데이터

손흥민의 과거 성적을 살펴보자.

son <- get_player_seasons_stats(player_id = 453)

son %>% 
  reactable::reactable()
 

데이터 과학자 이광춘 저작

kwangchun.lee.7@gmail.com