-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLabWeek4.Rmd
More file actions
84 lines (67 loc) · 1.75 KB
/
LabWeek4.Rmd
File metadata and controls
84 lines (67 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
title: "LabWeek4"
output: html_document
date: "2026-02-12"
---
```{r eval=FALSE}
install.packages("tidyverse")
```
```{r eval=FALSE}
library(tidyverse)
```
```{r eval=FALSE}
setwd("~/Desktop/Oxford/QStep")
```
```{r eval=FALSE}
qog <- read.csv("qog2022.csv")
```
```{r eval=FALSE}
ggplot(data = qog) +
geom_bar(mapping = aes(x = region))
```
```{r eval=FALSE}
ggplot(data = qog) +
geom_histogram(mapping = aes(x = wdi_wip), binwidth = 10) +
ggtitle("Women's Representation in World Parliaments") +
xlab("percentage of seats held by women") +
ylab("number of countries") +
facet_wrap("region")
ggsave("my_first_plot.jpg")
```
```{r}
ggplot(data = qog) +
geom_bar(mapping = aes(x = region, fill = region)) +
facet_wrap(~fh_status) +
theme(axis.text.x = element_blank()) +
theme(axis.ticks.x = element_blank()) +
theme(axis.title.x = element_blank())
```
```{r}
ggplot(data = qog) +
geom_point(mapping = aes(x = undp_hdi, y = wdi_wip, color = region)) +
xlab("Human Development Index") +
ylab("Percentage of Women in Parliament")
ggplot(data = qog) +
geom_text(mapping = aes(x = undp_hdi, y = wdi_wip, label = ccodealp),
size = 3) +
xlab("Human Development Index") +
ylab("Percentage of Women in Parliament")
```
```{r eval=FALSE}
asia <- qog %>% filter(region == "Asia")
high_hdi_democracies <- qog %>%
filter(undp_hdi > 0.9 & fh_status == "Free") %>%
select(cname, region, wdi_wip, undp_hdi)
high_hdi_democracies
```
```{r eval=FALSE}
ppi <- read.csv("ppi.csv")
dim(ppi)
colnames(ppi)
View(ppi)
new_dataframe <- full_join(qog, ppi, by = "ccodealp")
ggplot(data = new_dataframe) +
geom_point(mapping = aes(x = undp_hdi, y = parl_power_index)) +
xlab("Human Development Index (WDI)") +
ylab("Parliamentary Power Index (Fish-Kroeger)")
```