Political Science Analysis
R을 이용한 대한민국 민주주의 점수 변화
r-code-for-data-analysis
2024. 4. 6. 18:46
22대 총선 기간이라 정치 관심도가 높다.
아래 사이트를 통해서 연도별, 각 나라별 민주주의를 분석해서 점수화 한 걸 토대로 분석하였다.
How to download and animate the Varieties of Democracy (V-DEM) dataset in R
In this blog post, we will download the V-DEM datasets with their vdemdata package. It is still in development, so we will use the install_github() function from the devtools package devtools::inst…
rforpoliticalscience.com
5가지 항목을 가지고 민주주의 점수를 매긴 것이 있다. ( v2x_polyarchy : 선거, 자유, 참여, 숙의, 평등)
대한민국과 미국을 연도별로 대통령별로 점수 변화를 시각화해보자
패키지 로드 후 데이터 확인
#devtools::install_github("vdeminstitute/vdemdata")
library(tidyverse)
library(magrittr)
library(vdemdata)
library(stringr)
vdemdata::vdem -> vdem
vdemdata::find_var("mobilization") -> mob
vdemdata::codebook -> vdem_codebook
vdemdata::var_info("e_regionpol_6C") -> region_info
region_info$responses
vdem %<>%
filter(year %in% c(1900:2024)) |> arrange(country_name)
unique(vdem$country_name)
vdem 데이터프레임에서 대한민국과 미국 데이터를 따로 변수에 저장
korea <- vdem |> filter(country_text_id == "KOR")
usa <- vdem |> filter(country_text_id == "USA")
먼저 대한민국 데이터를 연도별 민주주의 점수를 시각화해보자
text <- tibble::tribble(
~year, ~v2x_polyarchy, ~country_name, ~party,
1948L, 0.5, "이승만", "독재",
1960L, 0.5, "윤보선", "내각",
1963L, 0.5, "박정희", "군부",
1980L, 0.5, "전두환", "군부",
1988L, 0.5, "노태우", "보수",
1993L, 0.5, "김영삼", "진보",
1998L, 0.5, "김대중", "진보",
2003L, 0.5, "노무현", "진보",
2008L, 0.5, "이명박", "보수",
2013L, 0.5, "박근혜", "보수",
2017L, 0.5, "문재인", "진보",
2022L, 0.5, "윤석열", "보수"
)
korea |>
filter(year>1948) |>
ggplot(aes(year, v2x_polyarchy, col=country_name))+
geom_point()+
geom_vline(xintercept = year, linetype='dashed', color='blue', size=0.1)+
scale_y_continuous(limits = c(0, 1))+
geom_text( data = text, aes(x = ifelse(year == 1960, year, year+2), y = v2x_polyarchy, label=country_name ))+
labs(title = "대한민국 대통령과 민주주의 점수",
subtitle = "선거, 자유, 참여, 숙의, 평등",
caption = "data : https://github.com/vdeminstitute/vdemdata",
y= "민주주의 점수")+
theme_bw()+
theme(legend.position = "none")
다음은 미국 데이터로 시각화해보자
text2 <- tibble::tribble(
~country_name, ~year, ~v2x_polyarchy, ~party,
"루스벨트", 1901L, 0.2, "공화당",
"태프트", 1909L, 0.3, "공화당",
"윌슨", 1913L, 0.2, "민주당",
"하딩", 1921L, 0.3, "공화당",
"쿨리지", 1923L, 0.2, "공화당",
"후버", 1929L, 0.3, "공화당",
"루스벨트", 1933L, 0.2, "민주당",
"트루먼", 1945L, 0.3, "민주당",
"아이젠하워", 1953L, 0.2, "공화당",
"케네디", 1961L, 0.3, "민주당",
"존슨", 1963L, 0.2, "민주당",
"닉슨", 1969L, 0.3, "공화당",
"포드", 1974L, 0.2, "공화당",
"카터", 1977L, 0.3, "민주당",
"레이건", 1981L, 0.2, "공화당",
"부시", 1989L, 0.3, "공화당",
"클린턴", 1993L, 0.2, "민주당",
"부시", 2001L, 0.3, "공화당",
"오바마", 2009L, 0.2, "민주당",
"트럼프", 2017L, 0.3, "공화당",
"바이든", 2021L, 0.2, "민주당"
)
usa |>
ggplot(aes(year, v2x_polyarchy, col=country_name))+
geom_point()+
geom_vline(xintercept = text2$year, linetype='dashed', color='blue', size=0.1)+
scale_y_continuous(limits = c(0, 1))+
geom_text(data = text2, aes(x = ifelse(country_name %in% c("하딩", "후버", "케네디", "포드"), year+1, year+3), y = v2x_polyarchy, label=country_name ,
col = party))+
labs(title = "미국 대통령과 민주주의 점수",
subtitle = "선거, 자유, 참여, 숙의, 평등",
caption = "data : https://github.com/vdeminstitute/vdemdata",
y= "민주주의 점수")+
theme_bw()+
theme(legend.position = "none")
왜 보수 대통령은 민주주의 점수를 떨어뜨리는가?
미국이든 대한민국이든...
728x90
반응형