# List of packages
packages <- c("tidyr", "dplyr", "ggplot2", "modelsummary", "forcats", "RColorBrewer",
"fst", "viridis", "knitr", "kableExtra", "rmarkdown", "ggridges", "viridis", "questionr") # add any you need here
# Install packages if they aren't installed already
new_packages <- packages[!(packages %in% installed.packages()[,"Package"])]
if(length(new_packages)) install.packages(new_packages)
# Load the packages
lapply(packages, library, character.only = TRUE)
##
## 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
## Loading required package: viridisLite
##
## Attaching package: 'kableExtra'
## The following object is masked from 'package:dplyr':
##
## group_rows
## [[1]]
## [1] "tidyr" "stats" "graphics" "grDevices" "utils" "datasets"
## [7] "methods" "base"
##
## [[2]]
## [1] "dplyr" "tidyr" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[3]]
## [1] "ggplot2" "dplyr" "tidyr" "stats" "graphics" "grDevices"
## [7] "utils" "datasets" "methods" "base"
##
## [[4]]
## [1] "modelsummary" "ggplot2" "dplyr" "tidyr" "stats"
## [6] "graphics" "grDevices" "utils" "datasets" "methods"
## [11] "base"
##
## [[5]]
## [1] "forcats" "modelsummary" "ggplot2" "dplyr" "tidyr"
## [6] "stats" "graphics" "grDevices" "utils" "datasets"
## [11] "methods" "base"
##
## [[6]]
## [1] "RColorBrewer" "forcats" "modelsummary" "ggplot2" "dplyr"
## [6] "tidyr" "stats" "graphics" "grDevices" "utils"
## [11] "datasets" "methods" "base"
##
## [[7]]
## [1] "fst" "RColorBrewer" "forcats" "modelsummary" "ggplot2"
## [6] "dplyr" "tidyr" "stats" "graphics" "grDevices"
## [11] "utils" "datasets" "methods" "base"
##
## [[8]]
## [1] "viridis" "viridisLite" "fst" "RColorBrewer" "forcats"
## [6] "modelsummary" "ggplot2" "dplyr" "tidyr" "stats"
## [11] "graphics" "grDevices" "utils" "datasets" "methods"
## [16] "base"
##
## [[9]]
## [1] "knitr" "viridis" "viridisLite" "fst" "RColorBrewer"
## [6] "forcats" "modelsummary" "ggplot2" "dplyr" "tidyr"
## [11] "stats" "graphics" "grDevices" "utils" "datasets"
## [16] "methods" "base"
##
## [[10]]
## [1] "kableExtra" "knitr" "viridis" "viridisLite" "fst"
## [6] "RColorBrewer" "forcats" "modelsummary" "ggplot2" "dplyr"
## [11] "tidyr" "stats" "graphics" "grDevices" "utils"
## [16] "datasets" "methods" "base"
##
## [[11]]
## [1] "rmarkdown" "kableExtra" "knitr" "viridis" "viridisLite"
## [6] "fst" "RColorBrewer" "forcats" "modelsummary" "ggplot2"
## [11] "dplyr" "tidyr" "stats" "graphics" "grDevices"
## [16] "utils" "datasets" "methods" "base"
##
## [[12]]
## [1] "ggridges" "rmarkdown" "kableExtra" "knitr" "viridis"
## [6] "viridisLite" "fst" "RColorBrewer" "forcats" "modelsummary"
## [11] "ggplot2" "dplyr" "tidyr" "stats" "graphics"
## [16] "grDevices" "utils" "datasets" "methods" "base"
##
## [[13]]
## [1] "ggridges" "rmarkdown" "kableExtra" "knitr" "viridis"
## [6] "viridisLite" "fst" "RColorBrewer" "forcats" "modelsummary"
## [11] "ggplot2" "dplyr" "tidyr" "stats" "graphics"
## [16] "grDevices" "utils" "datasets" "methods" "base"
##
## [[14]]
## [1] "questionr" "ggridges" "rmarkdown" "kableExtra" "knitr"
## [6] "viridis" "viridisLite" "fst" "RColorBrewer" "forcats"
## [11] "modelsummary" "ggplot2" "dplyr" "tidyr" "stats"
## [16] "graphics" "grDevices" "utils" "datasets" "methods"
## [21] "base"
ess <- read_fst("All-ESS-Data.fst")
print("hell yeah this works!")
## [1] "hell yeah this works!"
Mission 1
table(ess$yrbrn)
##
## 1885 1893 1900 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914
## 1 1 5 1 1 3 5 3 7 9 33 41 53 91 109 140
## 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930
## 157 218 267 332 445 695 811 1093 1169 1323 1660 1815 1929 2439 2604 3071
## 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946
## 3280 3445 3625 3869 4280 4620 4802 5206 5634 6190 5848 5884 6055 6366 6642 7347
## 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962
## 7797 7961 8017 8586 7963 8293 8008 8206 8401 8449 8303 8423 8250 9020 8483 8652
## 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978
## 8347 8705 8836 8543 8313 8407 8273 8627 8054 8153 7656 7820 7879 7691 7463 7482
## 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994
## 7388 8020 7173 7272 6902 6947 7059 6963 6616 6364 6020 5651 4970 4550 4372 3567
## 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 7777 8888 9999
## 3454 3062 2764 2318 2095 1884 1476 1243 1059 698 574 294 10 962 245 1898
table(ess$vote)
##
## 1 2 3 7 8 9
## 350196 99401 35872 1195 3078 813
## for yrbrn, filter out 7777, 8888, 9999
## for vote, filter out 3, 7, 8, 9
Mission 2
table(ess$stfjb)
##
## 0 1 2 3 4 5 6 7 8 9 10 66 77
## 484 382 836 1453 1653 4492 4503 8643 12964 7737 6679 46917 47
## 88 99
## 276 607
## variable is stfjb - how satisifed with job
## filter out 66, 77, 88, 99
## could record 0-3 as unsatified, and 7-10 as satisfied if you wanted a binary variable
Mission 3
table(ess$essround)
##
## 1 2 3 4 5 6 7 8 9 10
## 42359 47537 43000 56752 52458 54673 40185 44387 49519 59685
ess$year <- NA
replacements <- c(2002, 2004, 2006, 2008, 2010, 2012, 2014, 2016, 2018, 2020)
for(i in 1:10){
ess$year[ess$essround == i] <- replacements[i]
}
russia_data <- ess %>%
filter(cntry == "RU") %>%
select(yrbrn, vote, stfjb, essround, year)
russia_data_clean <- russia_data %>%
mutate(
yrbrn = ifelse(yrbrn %in% c(7777, 8888, 9999), NA, yrbrn),
vote = ifelse(vote %in% c(3, 7, 8, 9), NA, vote),
vote_binary = ifelse(vote == 1, "Yes", "No"),
stfjb = ifelse(stfjb %in% c(66, 77, 88, 99), NA, stfjb),
)
table(russia_data$yrbrn)
##
## 1912 1913 1914 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928
## 1 1 1 5 4 3 7 2 4 9 31 32 37 46 41 76
## 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944
## 74 87 83 92 76 86 115 137 160 169 152 180 164 102 99 103
## 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960
## 117 163 210 179 202 206 195 209 174 231 193 201 219 205 194 229
## 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976
## 214 193 170 205 188 211 187 201 161 198 207 208 196 206 187 227
## 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992
## 199 195 190 238 210 210 225 234 216 273 249 224 221 235 195 141
## 1993 1994 1995 1996 1997 1998 1999 2000 2001 7777 9999
## 130 97 87 67 44 31 17 19 15 3 28
table(russia_data_clean$yrbrn)
##
## 1912 1913 1914 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928
## 1 1 1 5 4 3 7 2 4 9 31 32 37 46 41 76
## 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944
## 74 87 83 92 76 86 115 137 160 169 152 180 164 102 99 103
## 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960
## 117 163 210 179 202 206 195 209 174 231 193 201 219 205 194 229
## 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976
## 214 193 170 205 188 211 187 201 161 198 207 208 196 206 187 227
## 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992
## 199 195 190 238 210 210 225 234 216 273 249 224 221 235 195 141
## 1993 1994 1995 1996 1997 1998 1999 2000 2001
## 130 97 87 67 44 31 17 19 15
table(russia_data$vote)
##
## 1 2 3 7 8
## 7749 3858 668 12 171
table(russia_data_clean$vote)
##
## 1 2
## 7749 3858
table(russia_data_clean$vote_binary)
##
## No Yes
## 3858 7749
table(russia_data$stfjb)
##
## 0 1 2 3 4 5 6 7 8 9 10 66 88 99
## 59 36 91 160 161 457 279 423 426 218 336 2203 64 8
table(russia_data_clean$stfjb)
##
## 0 1 2 3 4 5 6 7 8 9 10
## 59 36 91 160 161 457 279 423 426 218 336
Mission 4
datasummary_skim(russia_data_clean %>% select(vote, yrbrn, stfjb))
Unique (#)
Missing (%)
Mean
SD
Min
Median
Max
vote
3
7
1.3
0.5
1.0
1.0
2.0
yrbrn
90
0
1964.4
18.9
1912.0
1965.0
2001.0
stfjb
12
79
6.4
2.5
0.0
7.0
10.0
Mission 6
table(russia_data_clean$stfjb, russia_data_clean$vote) %>%
cprop()
##
## 1 2 All
## 0 1.9 2.4 2.1
## 1 1.3 1.1 1.3
## 2 3.7 3.1 3.5
## 3 5.8 6.5 6.0
## 4 5.5 7.1 6.0
## 5 17.1 17.7 17.3
## 6 10.0 12.0 10.7
## 7 15.8 16.3 16.0
## 8 17.5 13.7 16.2
## 9 8.7 7.8 8.4
## 10 12.7 12.4 12.6
## Total 100.0 100.0 100.0
table(russia_data_clean$yrbrn, russia_data_clean$vote) %>%
cprop()
##
## 1 2 All
## 1912 0.0 0.0 0.0
## 1913 0.0 0.0 0.0
## 1914 0.0 0.0 0.0
## 1916 0.0 0.0 0.0
## 1917 0.0 0.1 0.0
## 1918 0.0 0.0 0.0
## 1919 0.1 0.1 0.1
## 1920 0.0 0.0 0.0
## 1921 0.1 0.0 0.0
## 1922 0.1 0.1 0.1
## 1923 0.3 0.3 0.3
## 1924 0.3 0.1 0.3
## 1925 0.4 0.1 0.3
## 1926 0.5 0.3 0.4
## 1927 0.4 0.2 0.3
## 1928 0.8 0.3 0.6
## 1929 0.8 0.4 0.6
## 1930 0.9 0.4 0.8
## 1931 0.8 0.6 0.7
## 1932 0.9 0.6 0.8
## 1933 0.8 0.4 0.7
## 1934 0.8 0.7 0.7
## 1935 1.2 0.6 1.0
## 1936 1.5 0.5 1.2
## 1937 1.7 0.8 1.4
## 1938 1.7 0.9 1.4
## 1939 1.7 0.4 1.3
## 1940 1.9 0.9 1.5
## 1941 1.7 0.9 1.4
## 1942 1.0 0.6 0.9
## 1943 1.0 0.6 0.8
## 1944 1.1 0.5 0.9
## 1945 1.2 0.6 1.0
## 1946 1.6 0.9 1.4
## 1947 2.2 1.0 1.8
## 1948 1.8 0.9 1.5
## 1949 2.2 0.8 1.7
## 1950 2.0 1.2 1.8
## 1951 2.0 1.0 1.7
## 1952 2.0 1.4 1.8
## 1953 1.6 1.2 1.5
## 1954 2.1 1.8 2.0
## 1955 1.9 1.1 1.6
## 1956 1.9 1.2 1.7
## 1957 2.1 1.5 1.9
## 1958 1.8 1.6 1.8
## 1959 1.7 1.6 1.7
## 1960 2.0 1.8 2.0
## 1961 2.0 1.5 1.8
## 1962 1.8 1.3 1.6
## 1963 1.5 1.2 1.4
## 1964 1.9 1.5 1.7
## 1965 1.6 1.5 1.6
## 1966 1.9 1.6 1.8
## 1967 1.4 1.8 1.6
## 1968 1.5 2.2 1.7
## 1969 1.3 1.4 1.3
## 1970 1.7 1.7 1.7
## 1971 1.7 1.9 1.8
## 1972 1.6 2.0 1.8
## 1973 1.6 1.7 1.6
## 1974 1.7 1.8 1.7
## 1975 1.5 1.7 1.6
## 1976 1.7 2.3 1.9
## 1977 1.3 2.3 1.7
## 1978 1.4 2.0 1.6
## 1979 1.4 1.9 1.6
## 1980 1.7 2.6 2.0
## 1981 1.2 2.7 1.7
## 1982 1.4 2.5 1.8
## 1983 1.6 2.6 1.9
## 1984 1.7 2.6 2.0
## 1985 1.6 2.2 1.8
## 1986 1.7 3.4 2.3
## 1987 1.3 3.4 2.0
## 1988 1.2 2.9 1.8
## 1989 1.1 3.2 1.8
## 1990 0.6 1.8 1.0
## 1991 0.4 1.9 0.9
## 1992 0.5 1.3 0.8
## 1993 0.4 0.9 0.6
## 1994 0.2 0.6 0.3
## 1995 0.2 0.5 0.3
## 1996 0.2 0.5 0.3
## 1997 0.1 0.3 0.2
## Total 100.0 100.0 100.0
Mission 7
yrbrnvote <- datasummary_crosstab(yrbrn ~ vote, data = russia_data_clean)
yrbrnvote
yrbrn
1
2
All
1912
N
0
1
1
% row
0.0
100.0
100.0
1913
N
0
1
1
% row
0.0
100.0
100.0
1914
N
1
0
1
% row
100.0
0.0
100.0
1916
N
3
1
5
% row
60.0
20.0
100.0
1917
N
2
2
4
% row
50.0
50.0
100.0
1918
N
2
1
3
% row
66.7
33.3
100.0
1919
N
4
3
7
% row
57.1
42.9
100.0
1920
N
2
0
2
% row
100.0
0.0
100.0
1921
N
4
0
4
% row
100.0
0.0
100.0
1922
N
7
2
9
% row
77.8
22.2
100.0
1923
N
20
10
31
% row
64.5
32.3
100.0
1924
N
26
3
32
% row
81.2
9.4
100.0
1925
N
33
4
37
% row
89.2
10.8
100.0
1926
N
35
10
46
% row
76.1
21.7
100.0
1927
N
30
9
41
% row
73.2
22.0
100.0
1928
N
62
11
76
% row
81.6
14.5
100.0
1929
N
59
14
74
% row
79.7
18.9
100.0
1930
N
70
17
87
% row
80.5
19.5
100.0
1931
N
59
22
83
% row
71.1
26.5
100.0
1932
N
68
22
92
% row
73.9
23.9
100.0
1933
N
62
14
76
% row
81.6
18.4
100.0
1934
N
60
26
86
% row
69.8
30.2
100.0
1935
N
91
23
115
% row
79.1
20.0
100.0
1936
N
116
20
137
% row
84.7
14.6
100.0
1937
N
129
30
160
% row
80.6
18.8
100.0
1938
N
132
34
169
% row
78.1
20.1
100.0
1939
N
135
17
152
% row
88.8
11.2
100.0
1940
N
146
33
180
% row
81.1
18.3
100.0
1941
N
128
34
164
% row
78.0
20.7
100.0
1942
N
77
24
102
% row
75.5
23.5
100.0
1943
N
76
22
99
% row
76.8
22.2
100.0
1944
N
82
18
103
% row
79.6
17.5
100.0
1945
N
92
23
117
% row
78.6
19.7
100.0
1946
N
122
36
163
% row
74.8
22.1
100.0
1947
N
171
37
210
% row
81.4
17.6
100.0
1948
N
141
34
179
% row
78.8
19.0
100.0
1949
N
168
32
202
% row
83.2
15.8
100.0
1950
N
157
48
206
% row
76.2
23.3
100.0
1951
N
156
39
195
% row
80.0
20.0
100.0
1952
N
152
55
209
% row
72.7
26.3
100.0
1953
N
126
48
174
% row
72.4
27.6
100.0
1954
N
161
70
231
% row
69.7
30.3
100.0
1955
N
149
41
193
% row
77.2
21.2
100.0
1956
N
150
45
201
% row
74.6
22.4
100.0
1957
N
159
58
219
% row
72.6
26.5
100.0
1958
N
141
63
205
% row
68.8
30.7
100.0
1959
N
130
62
194
% row
67.0
32.0
100.0
1960
N
156
70
229
% row
68.1
30.6
100.0
1961
N
152
57
214
% row
71.0
26.6
100.0
1962
N
137
49
193
% row
71.0
25.4
100.0
1963
N
116
48
170
% row
68.2
28.2
100.0
1964
N
146
56
205
% row
71.2
27.3
100.0
1965
N
127
56
188
% row
67.6
29.8
100.0
1966
N
144
60
211
% row
68.2
28.4
100.0
1967
N
112
70
187
% row
59.9
37.4
100.0
1968
N
114
83
201
% row
56.7
41.3
100.0
1969
N
102
54
161
% row
63.4
33.5
100.0
1970
N
131
64
198
% row
66.2
32.3
100.0
1971
N
131
72
207
% row
63.3
34.8
100.0
1972
N
125
78
208
% row
60.1
37.5
100.0
1973
N
124
65
196
% row
63.3
33.2
100.0
1974
N
129
71
206
% row
62.6
34.5
100.0
1975
N
116
66
187
% row
62.0
35.3
100.0
1976
N
134
88
227
% row
59.0
38.8
100.0
1977
N
104
89
199
% row
52.3
44.7
100.0
1978
N
112
77
195
% row
57.4
39.5
100.0
1979
N
111
72
190
% row
58.4
37.9
100.0
1980
N
133
99
238
% row
55.9
41.6
100.0
1981
N
96
105
210
% row
45.7
50.0
100.0
1982
N
110
95
210
% row
52.4
45.2
100.0
1983
N
122
101
225
% row
54.2
44.9
100.0
1984
N
128
100
234
% row
54.7
42.7
100.0
1985
N
122
86
216
% row
56.5
39.8
100.0
1986
N
130
132
273
% row
47.6
48.4
100.0
1987
N
101
130
249
% row
40.6
52.2
100.0
1988
N
91
112
224
% row
40.6
50.0
100.0
1989
N
88
123
221
% row
39.8
55.7
100.0
1990
N
43
69
235
% row
18.3
29.4
100.0
1991
N
34
73
195
% row
17.4
37.4
100.0
1992
N
38
50
141
% row
27.0
35.5
100.0
1993
N
34
33
130
% row
26.2
25.4
100.0
1994
N
15
22
97
% row
15.5
22.7
100.0
1995
N
14
19
87
% row
16.1
21.8
100.0
1996
N
12
21
67
% row
17.9
31.3
100.0
1997
N
8
13
44
% row
18.2
29.5
100.0
1998
N
0
0
31
% row
0.0
0.0
100.0
1999
N
0
0
17
% row
0.0
0.0
100.0
2000
N
0
0
19
% row
0.0
0.0
100.0
2001
N
0
0
15
% row
0.0
0.0
100.0
All
N
7749
3858
12458
% row
62.2
31.0
100.0
Mission 8
table(russia_data_clean$vote_binary, russia_data_clean$yrbrn) %>%
cprop() %>%
as.data.frame() %>%
filter(Var1 != "Total",
Var2 != "All") %>%
ggplot(aes(x=Var2 %>% as.character() %>% as.integer(),
y=Freq,
color=Var1)) +
geom_line() +
labs(title="Voting by Birth Year",
x = "Birth Year",
color = "Voted",
)
Mission 11
vote_by_year <- russia_data_clean %>%
group_by(year) %>%
summarize(mean_vote = mean(vote, na.rm = TRUE))
vote_by_year
## # A tibble: 5 × 2
## year mean_vote
## <dbl> <dbl>
## 1 2006 1.34
## 2 2008 1.25
## 3 2010 1.31
## 4 2012 1.32
## 5 2016 1.43
ggplot(vote_by_year, aes(x = year, y = mean_vote)) +
geom_line(color = "blue", size = 1) + # Line to show the trend
geom_point(color = "red", size = 3) + # Points to highlight each year's value
labs(title = "Liklehood to Vote in Russia (2006-2016)",
x = "Year",
y = "Mean Vote (Yes-No scale)") +
ylim(1, 2) +
theme_minimal()
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
Mission 13
ess$vote[ess$vote %in% c(3, 7, 8, 9)] <- NA
avg_vote_russia <- russia_data_clean %>%
group_by(year) %>%
summarize(mean_vote_russia = mean(vote, na.rm = TRUE))
# Compute the average trust for each year for all countries in the ess dataset.
avg_vote_all_countries <- ess %>%
group_by(year) %>%
summarize(mean_vote_all = mean(vote, na.rm = TRUE))
avg_vote_all_countries
## # A tibble: 10 × 2
## year mean_vote_all
## <dbl> <dbl>
## 1 2002 1.20
## 2 2004 1.23
## 3 2006 1.22
## 4 2008 1.22
## 5 2010 1.24
## 6 2012 1.24
## 7 2014 1.23
## 8 2016 1.23
## 9 2018 1.22
## 10 2020 1.18
# Combine the data
# 'left_join' is a function to merge two datasets side by side. We want to merge 'avg_trust_france' and 'avg_trust_all_countries'.
# The merge is based on the "year" column, which means rows with matching years in both datasets will be combined.
combined_data <- left_join(avg_vote_russia, avg_vote_all_countries, by = "year")
# Reshape to long format
# The next set of commands are used to reshape data.
# This is often done to make data more suitable for certain types of analysis or visualization.
# 'pivot_longer' is a function that makes a dataset longer by turning columns into rows.
long_data <- combined_data %>%
# 'pivot_longer' function is used to convert data from a wide format to a long format.
# This is useful for making certain types of graphs or conducting specific analyses.
pivot_longer(
cols = starts_with("mean_vote"), # We choose columns that start with "mean_trust" to pivot/reshape.
# 'names_to' specifies the name of the new column that will hold the original column names.
names_to = "Vote_Type",
# 'values_to' specifies the name of the new column that will hold the values from the original columns.
values_to = "Mean_Vote"
)
# Plot using ggplot2
ggplot(long_data) +
geom_line(aes(x = year, y = Mean_Vote, color = Vote_Type), size = 1) +
geom_point(aes(x = year, y = Mean_Vote, color = Vote_Type), size = 3) +
labs(title = "Likelihood to Vote in Russia vs Europe (2006-2016)",
x = "Year",
y = "Mean Vote (Yes-No scale)") +
ylim(1, 2) +
scale_color_manual(values = c("blue", "red"),
name = "Dataset",
labels = c("Russia", "All ESS"),
breaks = c("mean_vote_russia", "mean_vote_all")) +
theme_minimal()