본문 바로가기
  • "You can't manage what you can't measure" Peter Drucker
스포츠_스포츠_Sports

Rstudio with FIFA 월드컵 데이터 (2022년 카타르 추가)

by Vitaminymc 2023. 8. 7.
반응형

연도별 개최 국가 (2022년 카타르 포함)

wcmatches_2020.csv : 2022년 Qatar (카타르) 월드컵 결과 추가

wcmatches_2022.csv
0.01MB
Image Sourec : https://en.wikipedia.org/wiki/2022_FIFA_World_Cup

city stage home_team away_team home_score away_score outcome win_conditions winning_team losing_team date
Al Khor Group A Qatar Ecuador 0 2 A NA Ecuador Qatar 2022-11-20
Doha Group A Senegal Netherlands 0 2 A NA Netherlands Senegal 2022-11-21
Doha Group A Qatar Senegal 1 3 A NA Senegal Qatar 2022-11-25
Al Rayyan Group A Netherlands Ecuador 1 1 D NA NA NA 2022-11-25
Al Rayyan Group A Ecuador Senegal 1 2 A NA Senegal Ecuador 2022-11-29
Al Khor Group A Netherlands Qatar 2 0 H NA Netherlands Qatar 2022-11-29
Al Rayyan Group B England Iran 6 2 H NA England Iran 2022-11-21
Al Rayyan Group B United States Wales 1 1 D NA NA NA 2022-11-21
Al Rayyan Group B Wales Iran 0 2 A NA Iran Wales 2022-11-25
Al Rayyan Group B England United States 0 0 D NA NA NA 2022-11-25
Al Rayyan Group B Wales England 0 3 A NA England Wales 2022-11-29
Doha Group B Iran United States 0 1 A NA United States Iran 2022-11-29
Lusail Group C Argentina Saudi Arabia 1 2 A NA Saudi Arabia Argentina 2022-11-22
Doha Group C Mexico Poland 0 0 D NA NA NA 2022-11-22
Al Rayyan Group C Poland Saudi Arabia 2 0 H NA Poland Saudi Arabia 2022-11-26
Lusail Group C Argentina Mexico 2 0 H NA Argentina Mexico 2022-11-26
Doha Group C Poland Argentina 0 2 A NA Argentina Poland 2022-11-30
Lusail Group C Saudi Arabia Mexico 1 2 A NA Mexico Saudi Arabia 2022-11-30
Al Rayyan Group D Denmark Tunisia 0 0 D NA NA NA 2022-11-22
Al Wakrah Group D France Australia 4 1 H NA France Australia 2022-11-22
Al Wakrah Group D Tunisia Australia 0 1 A NA Australia Tunisia 2022-11-26
Doha Group D France Denmark 2 1 H NA France Denmark 2022-11-26
Al Wakrah Group D Australia Denmark 1 0 H NA Australia Denmark 2022-11-30
Al Rayyan Group D Tunisia France 1 0 H NA Tunisia France 2022-11-30
Al Rayyan Group E Germany Japan 1 2 A NA Japan Germany 2022-11-23
Doha Group E Spain Costa Rica 7 0 H NA Spain Costa Rica 2022-11-23
Al Rayyan Group E Japan Costa Rica 0 1 A NA Costa Rica Japan 2022-11-27
Al Khor Group E Spain Germany 1 1 D NA NA NA 2022-11-27
Al Rayyan Group E Japan Spain 2 1 H NA Japan Spain 2022-12-01
Al Khor Group E Costa Rica Germany 2 4 A NA Germany Costa Rica 2022-12-01
Al Khor Group F Morocco Croatia 0 0 D NA NA NA 2022-11-23
Al Rayyan Group F Belgium Canada 1 0 H NA Belgium Canada 2022-11-23
Doha Group F Belgium Morocco 0 2 A NA Morocco Belgium 2022-11-27
Al Rayyan Group F Croatia Canada 4 1 H NA Croatia Canada 2022-11-27
Al Rayyan Group F Croatia Belgium 0 0 D NA NA NA 2022-12-01
Doha Group F Canada Morocco 1 2 A NA Morocco Canada 2022-12-01
Al Wakrah Group G Switzerland Cameroon 1 0 H NA Switzerland Cameroon 2022-11-24
Lusail Group G Brazil Serbia 2 0 H NA Brazil Serbia 2022-11-24
Al Wakrah Group G Cameroon Serbia 3 3 D NA NA NA 2022-11-28
Doha Group G Brazil Switzerland 1 0 H NA Brazil Switzerland 2022-11-28
Doha Group G Serbia Switzerland 2 3 A NA Switzerland Serbia 2022-12-02
Lusail Group G Cameroon Brazil 1 0 H NA Cameroon Brazil 2022-12-02
Al Rayyan Group H Uruguay South Korea 0 0 D NA NA NA 2022-11-24
Doha Group H Portugal Ghana 3 2 H NA Portugal Ghana 2022-11-24
Al Rayyan Group H South Korea Ghana 2 3 A NA Ghana South Korea 2022-11-28
Lusail Group H Portugal Uruguay 2 0 H NA Portugal Uruguay 2022-11-28
Al Wakrah Group H Ghana Uruguay 0 2 A NA Uruguay Ghana 2022-12-02
Al Rayyan Group H South Korea Portugal 2 1 H NA South Korea Portugal 2022-12-02
Al Rayyan Round of 16 Netherlands United States 3 1 H NA Netherlands United States 2022-12-03
Al Rayyan Round of 16 Argentina Australia 2 1 H NA Argentina Australia 2022-12-03
Al Wakrah Round of 16 Japan Croatia 1 1 A Croatia wins 3 - 1  on penalties Croatia Japan 2022-12-05
Doha Round of 16 Brazil South Korea 4 1 H NA Brazil South Korea 2022-12-05
Al Khor Round of 16 England Senegal 3 0 H NA England Senegal 2022-12-04
Doha Round of 16 France Poland 3 1 H NA France Poland 2022-12-04
Al Rayyan Round of 16 Morocco Spain 0 0 H Morocco wins 3 - 0  on penalties Morocco Spain 2022-12-06
Lusail Round of 16 Portugal Switzerland 6 1 H NA Portugal Switzerland 2022-12-06
Lusail Quarterfinals Netherlands Argentina 2 2 A Argentina wins 4 - 3  on penalties Argentina Netherlands 2022-12-09
Al Rayyan Quarterfinals Croatia Brazil 1 1 H Croatia wins 4 - 2  on penalties Croatia Brazil 2022-12-09
Al Khor Quarterfinals England France 1 2 A NA France England 2022-12-10
Doha Quarterfinals Morocco Portugal 1 0 H NA Morocco Portugal 2022-12-10
Lusail Semifinals Argentina Croatia 3 0 H NA Argentina Croatia 2022-12-13
Al Khor Semifinals France Morocco 2 0 H NA France Morocco 2022-12-14
Al Rayyan Third place Croatia Morocco 2 1 H NA Croatia Morocco 2022-12-17
Lusail Final Argentina France 3 3 H Argentina wins 4 - 2  on penalties Argentina France 2022-12-18
  • city의 경기장은 미구분, 작은 국가이나 GDP가 높은 국가로 월드컵을 위해서, 한 개 도시에 복수의 경기장 건설
City Stadium Capacity
Lusail Lusail Stadium 88966
Al Khor Al Bayt Stadium 68895
Al Rayyan Khalifa International Stadium 45857
Al Rayyan Ahmad bin Ali Stadium 45032
Al Rayyan Education City Stadium 44667
Doha Al Thumama Stadium 44400
Doha Stadium 974 44089
Al Wakrah Al Janoub Stadium 44325

Source : https://en.wikipedia.org/wiki/2022_FIFA_World_Cup#Venues

 worldcups_to_2022.csv

worldcups_to_2022.csv
0.00MB

year host winner second third fourth goals_scored teams games attendance
1930 Uruguay Uruguay Argentina USA Yugoslavia 70 13 18 434000
1934 Italy Italy Czechoslovakia Germany Austria 70 16 17 395000
1938 France Italy Hungary Brazil Sweden 84 15 18 483000
1950 Brazil Uruguay Brazil Sweden Spain 88 13 22 1337000
1954 Switzerland West Germany Hungary Austria Uruguay 140 16 26 943000
1958 Sweden Brazil Sweden France West Germany 126 16 35 868000
1962 Chile Brazil Czechoslovakia Chile Yugoslavia 89 16 32 776000
1966 England England West Germany Portugal Soviet Union 89 16 32 1614677
1970 Mexico Brazil Italy West Germany Uruguay 95 16 32 1673975
1974 Germany West Germany Netherlands Poland Brazil 97 16 38 1774022
1978 Argentina Argentina Netherlands Brazil Italy 102 16 38 1610215
1982 Spain Italy West Germany Poland France 146 24 52 1856277
1986 Mexico Argentina West Germany France Belgium 132 24 52 2407431
1990 Italy West Germany Argentina Italy England 115 24 52 2527348
1994 USA Brazil Italy Sweden Bulgaria 141 24 52 3568567
1998 France France Brazil Croatia Netherlands 171 32 64 2859234
2002 Japan, South Korea Brazil Germany Turkey South Korea 161 32 64 2724604
2006 Germany Italy France Germany Portugal 147 32 64 3367000
2010 South Africa Spain Netherlands Germany Uruguay 145 32 64 2167984
2014 Brazil Germany Argentina Netherlands Brazil 171 32 64 3441450
2018 Russia France Croatia Belgium England 169 32 64 3031768
2022 Qatar Argentina France Croatia Morocco 172 32 64 3404252

기존 데이터 세트와 합치기 (rbind)

names (wcmatches)  #1930~2008년 월드컵 결과 데이터 세트의 변수명 확인
 [1] "year"           "country"        "city"           "stage"         
 [5] "home_team"      "away_team"      "home_score"     "away_score"    
 [9] "outcome"        "win_conditions" "winning_team"   "losing_team"   
[13] "date"           "month"          "dayofweek"    
nrow(wcmatches)  #데이터 수 확인
[1] 900
wc2022 <- read.csv('wcmatches_2022.csv')    #2022년 카타르 월드컵 결과

names (wc2022)
 [1] "year"           "country"        "city"           "stage"         
 [5] "home_team"      "away_team"      "home_score"     "away_score"    
 [9] "outcome"        "win_conditions" "winning_team"   "losing_team"   
[13] "date"           "month"          "dayofweek"   
nrow(wc2022)
[1] 64
total_wcmatches <- rbind(wcmatches, wc2022)    # rbin 함수를 사용하여 데이터 세트 합치기

nrow(total_wcmatches)
[1] 964
  • 두 데이터 세트의 변수명이 같으며, rbind를 통해서 합쳐짐
  • wcmatches 데이터 수는 900개,  wc2022 데이터 수는 64개로 합쳐서 964개 데이터를 가진
    total_wcmatches 데이터 세트가 생성됨

연도별 개최 국가 

library(tidyverse)

no_of_host2 <- total_wcmatches %>%
  group_by(year, country) %>%   #연도와 개최국 기준으로Grouping 
  summarise(tmp_no = n())         # temp_no는 연도와 개최국 기준의 row 수로 의미는 없음


no_of_host2 <- no_of_host2 %>% 
  select(-tmp_no)                       #의미없는 temp_no 제외


no_of_host2%>%
  tail()  
# A tibble: 6 × 2
# Groups:   year [6]
   year country     
  <int> <chr>       
1  2002 South Korea 
2  2006 Germany     
3  2010 South Africa
4  2014 Brazil      
5  2018 Russia      
6  2022 Qatar  
  • 2022 Qatar가 추가됨
728x90