Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.8 kB
4
Indexable
---
title: "Data Assignment 1"
author: "Jesús Martín Godoy"
format: pdf
editor: visual
---

# Activity 1

We want to check the growth of democratic regimes after WWI (1900-20) and the collapse of the Soviet Union (1986-1994). Generate graphics that show the evolution of the number of democracies by year using e_boix_regime (Boix, Miller and Rosato's measurement of democracy).

```{r}
library(ggplot2)
library(dplyr)

# Filtrar y agrupar los datos para contar el número de democracias por año
democracy_counts <- vdem %>%
  filter(e_boix_regime == 1) %>%
  group_by(year) %>%
  summarise(num_democracies = n())

# Crear la gráfica
ggplot(data = democracy_counts, aes(x = year, y = num_democracies)) +
  geom_line() +
  labs(x = "Año", y = "Número de Democracias", title = "Evolución del Número de Democracias en el Mundo")
```

```{r}
library(ggplot2)
library(dplyr)

# Filtrar los datos para el período 1900-1920
democracy_counts_1900_1920 <- vdem %>%
  filter(year >= 1900, year <= 1920, e_boix_regime == 1) %>%
  group_by(year) %>%
  summarise(num_democracies = n())

# Crear la gráfica
ggplot(data = democracy_counts_1900_1920, aes(x = year, y = num_democracies)) +
  geom_line() +
  labs(x = "Año", y = "Número de Democracias", title = "Evolución del Número de Democracias (1900-1920)")
```

```{r}
# Filtrar los datos para el período 1986-1994
democracy_counts_1986_1994 <- vdem %>%
  filter(year >= 1986, year <= 1994, e_boix_regime == 1) %>%
  group_by(year) %>%
  summarise(num_democracies = n())

# Crear la gráfica
ggplot(data = democracy_counts_1986_1994, aes(x = year, y = num_democracies)) +
  geom_line() +
  labs(x = "Año", y = "Número de Democracias", title = "Evolución del Número de Democracias (1986-1994)")
```