因為很少看到民主制度探討與運動相關的議題,想藉由這次機會,分析民主指數與運動表現的相關程度。
導入使用工具
library(devtools)
## Loading required package: usethis
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(readr)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(ggthemes)
library(d3heatmap)
library(magrittr)
將我們所需要的資料匯入
athlete_all <- read.csv('./athlete_all.csv')
tb <- athlete_all %>%
select(democracy_score,Medal) %>%
filter(Medal=="Gold") %>%
na.omit()
result <- tb %>%
group_by(democracy_score) %>%
summarise(number=n())
result %>% ggplot(aes(x=democracy_score)) + geom_col(aes(y=number))
r1 = athlete_all %>%
select(democracy_score,country) %>%
filter(democracy_score=="-7") %>%
na.omit() %>%
group_by(country) %>%
summarise(number=n())
r1 %>%
arrange(desc(number)) %>%
head(10)
## # A tibble: 10 x 2
## country number
## <fct> <int>
## 1 China 3823
## 2 Hungary 2888
## 3 Poland 2457
## 4 Bulgaria 2151
## 5 Cuba 1975
## 6 Romania 1521
## 7 Belarus 1310
## 8 Spain 957
## 9 Egypt 346
## 10 Mongolia 315
r2 = athlete_all %>%
select(democracy_score,country) %>%
filter(democracy_score=="10") %>%
na.omit() %>%
group_by(country) %>%
summarise(number=n())
r2 %>% arrange(desc(number)) %>% head(10)
## # A tibble: 10 x 2
## country number
## <fct> <int>
## 1 United States 16146
## 2 Canada 7910
## 3 Italy 7544
## 4 Japan 6551
## 5 Sweden 6549
## 6 Australia 6404
## 7 Germany 6034
## 8 Switzerland 5359
## 9 Netherlands 4743
## 10 Finland 4495
ea = athlete_all %>%
select(democracy_score,country, Medal) %>%
filter(democracy_score=="-7" & Medal == "Gold") %>%
na.omit() %>%
group_by(country) %>%
summarise(number=n())
ea %>% arrange(desc(number)) %>% head(10)
## # A tibble: 10 x 2
## country number
## <fct> <int>
## 1 Hungary 217
## 2 China 211
## 3 Cuba 148
## 4 Poland 68
## 5 Bulgaria 39
## 6 Pakistan 29
## 7 Romania 24
## 8 Belarus 15
## 9 Kenya 11
## 10 Azerbaijan 4
cy = athlete_all %>% select(democracy_score,country,Medal) %>%
filter(democracy_score=="10", Medal == "Gold") %>%
na.omit() %>%
group_by(country) %>%
summarise(number=n())
cy %>% arrange(desc(number)) %>% head(10)
## # A tibble: 10 x 2
## country number
## <fct> <int>
## 1 United States 2190
## 2 Germany 399
## 3 Canada 329
## 4 Italy 313
## 5 Australia 297
## 6 Sweden 294
## 7 Norway 266
## 8 Netherlands 234
## 9 Japan 201
## 10 Finland 166
由上述資料得知,民主制度雖不完全影響金牌獲得數量,但金牌獲得數以民主指數超過8以上之國家為大宗,故民主制度能對體育發展有一定優勢,民主仍是國家的發展王道,民主萬歲!!